Is it possible to use variables inside global env
sections in github workflows?
Something like following code snippet
env:
isqa: ""
local_tag: "${{env.isqa}}latest"
project: "important"
aws_taskdef: "project-${project}-something"
You cannot put these env
references on the same level, but you can specify the to-be-referenced values on the workflow or job level, and reference them in the step level. It would be something like this
jobs:
test:
runs-on: ubuntu-latest
env:
IS_QA: "qa"
PROJECT: "important"
steps:
- run:
echo ${{env.IS_QA}}
echo ${{env.LOCAL_TAG}}
echo ${{env.PROJECT}}
echo ${{env.AWS_TASKDEF}}
env:
LOCAL_TAG: "${{env.IS_QA}}-latest"
AWS_TASKDEF: "project-${{env.PROJECT}}-something"
You can see my testing in here, https://github.com/chenrui333/github-action-test/blob/main/.github/workflows/env-test.yaml