Skip to content

Assigning shell value to environment variable? #27199

Answered by airtower-luna
ajmas asked this question in Actions
Discussion options

You must be logged in to vote

Each run step gets its own shell instance, so exported variables don’t carry over. If you want that, you need to write to the GITHUB_ENV environment file, e.g.:

- name: Setup versions
  run: |
    echo "VERSION=99.99.99" >>${GITHUB_ENV}
    echo "DATE=$(date +%Y%m%d)" >>${GITHUB_ENV}

The VERSION and DATE environment variables will be available in all subsequent steps of the job.

For details, see Setting an environment variable.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants