Support environment variables and bash expressions in file names
See original GitHub issueIt would be great to be able to use environment variables and the output of bash expressions like below:
- name: Prepare GitHub Release
run: mv some.file some.file-$GITHUB_SHA-$(git describe --tags --exact-match)
- name: Release to GitHub Releases
uses: docker://softprops/action-gh-release
if: startsWith(github.ref, 'refs/tags/')
with:
files: some.file-$GITHUB_SHA-$(git describe --tags --exact-match)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to use variables in a filename? - Unix StackExchange
In this case Bash interprets domain_ as the name of the variable to expand. It's a valid name for a variable. Expanding this...
Read more >A Complete Guide to the Bash Environment Variables
A complete guide on the Linux Bash environment variables with details on how to set, unset, and use the specials shell variables or...
Read more >3.2. Variables
Global variables or environment variables are available in all shells. The env or printenv commands can be used to display environment variables.
Read more >Bash Reference Manual - GNU.org
Your users will use the LANG or LC_MESSAGES shell variables to select the desired language. You set the TEXTDOMAIN variable to the script's ......
Read more >Assign file names to a variable in shell - bash - Stack Overflow
I want each name of a list of files in a directory to be assigned to a variable (the same variable, one at...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It would be easier if access to environment vars, as well as to $HOME or ~ was available.
It took me some time to figure out this workaround: put the environment var you need into the
env
context, and the use that.To put the environment var you need into the
env
context, add this a step of your job:Then in softprops/action-gh-release@v1 step you can use it like this:
Maybe this can help someone.
If you don’t have the exact string you want in a GitHub context variable, you can use a step to create an output with the value you need. Example: