Home > database >  Populate version of s3 file dynamically on Github Actions
Populate version of s3 file dynamically on Github Actions

Time:08-17

I am trying to migrate from circle CI to GitHub actions and I am stuck at this step where I am trying to populate the version of a s3 file dynamically.

This is how it is being done on circle CI and it works fine

echo "export FILE_LOCATION='s3://xxx-xxx/'${PROJECT_NAME}_$(cat VERSION)'.zip'" >> $BASH_ENV

This is how I tried doing it on Github Actions config

env:
  NAME: '${{ github.repository }}_$(cat VERSION).zip'

However, I get the following error when I run it on GitHub actions

cat: VERSION: No such file or directory

Any idea how to handle such values to be dynamic on GitHub actions? TIA

CodePudding user response:

If you want to create an environment variable, add it to the file behind $GITHUB_ENV like so:

- run: echo "NAME=${{ github.repository }}_$(cat VERSION).zip" >> $GITHUB_ENV
- run: echo ${{ env. NAME }}

For more information, see the docs on Workflow commands for GitHub Actions / Setting an environment variable

  • Related