I would like to use custom environment variables related to specific environment based on environment selection from dropdown during deployment. How to get the custom variables related to specific environment from environment variable section. Any suggestions on how this can be achieved.
name: Adios CD pipeline.
on:
workflow_dispatch:
inputs:
ENVIRONMENT:
type: choice
description: 'Select the Environment to deploy'
required: true
options:
- dev
- qa
- uat
- load
- prod
default: 'dev'
env:
Dev:
AWS_REGION: "us-east-1"
STAGE: "${{ github.event.inputs.ENVIRONMENT }}"
SYSTEM: "ADIOSAPP"
QA:
AWS_REGION: "us-east-1"
STAGE: "${{ github.event.inputs.ENVIRONMENT }}"
SYSTEM: "ADIOSAPP"
jobs:
build:
name: "Deploying ${{ github.ref_name }} branch to ${{ github.event.inputs.ENVIRONMENT }} environment"
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.ENVIRONMENT }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ${{ env.AWS_REGION }}
2
Answers
As you already know mapping is not allowed at this place, byt you could use fromJson to mimic this:
I think you can also use secrets in different environments.