It would be nice if this supported arrays so that we could plugin the array as a matrix variable. Not sure if this is supported by Github Actions though. I'm thinking something like this:
determine-regions:
outputs:
regions: ${{ steps.export.outputs.regions }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: var-map
run: |
echo ::set-output name=content::$(cat ./.github/env_vars.json)
- uses: kanga333/variable-mapper@master
id: export
with:
key: "${{ github.event.inputs.environment }}"
map: ${{ steps.var-map.outputs.content }}
export_to: log,output
deploy:
environment: ${{ github.event.inputs.environment }}
needs: [ determine-regions ]
runs-on: ubuntu-latest
strategy:
matrix:
region: ${{ needs.determine-regions.outputs.regions }}
stack: [a, b, c]
fail-fast: true
max-parallel: 1
where the env_vars.json looks like this:
{
"production": {
"regions": ["us-east-1", "us-west-2"]
},
"uat": {
"regions": ["us-east-1", "us-west-2"]
}
}
I guess the work around is to encode the JSON array in the string and then use the toJson function github provides, but it would be nice to not have to do that.
It would be nice if this supported arrays so that we could plugin the array as a matrix variable. Not sure if this is supported by Github Actions though. I'm thinking something like this:
where the
env_vars.jsonlooks like this:I guess the work around is to encode the JSON array in the string and then use the
toJsonfunction github provides, but it would be nice to not have to do that.