cannot set tag_name from env variable
RunningLeon opened this issue Β· comments
RunningLeon commented
Hi, I was unable to set tag_name with an env variable, see the log below. The tag should be test
but it created a new tag $TAG_NAME
.
Run softprops/action-gh-release@v1
with:
tag_name: $TAG_NAME
files: ./prebuild/mmdeploy-1.1.0-linux-x86_64.tar.gz
token: ***
env:
PREBUILD_DIR: /data2/actions-runner/prebuild
MMDEPLOY_VERSION: 1.1.0
TAG_NAME: test
OUTPUT_DIR: /data2/actions-runner/prebuild/1.1.0
π©βπ Creating new GitHub release for tag $TAG_NAME...
β¬οΈ Uploading mmdeploy-1.1.0-linux-x86_64.tar.gz...
π Release ready at https://github.com/RunningLeon/mmdeploy/releases/tag/%[24](https://github.com/RunningLeon/mmdeploy/actions/runs/5109632465/jobs/9184633360#step:7:24)TAG_NAME
##[debug]Node Action run completed with exit code 0
Kevin Matthes commented
This is due to security reasons for GitHub Action workflow files: you are not allowed to execute shell scripts as inputs for Actions. But you can make the environment variable a GitHub output and call that output instead:
- id: tag_name
run: echo "version=$TAG_NAME" >> "$GITHUB_OUTPUT"
env:
TAG_NAME: test
- uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.tag_name.outputs.version }}
RunningLeon commented
Thanks for your reply. I've used gh script
to upload assets.
- name: Upload assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${TAG_NAME} ${OUTPUT_DIR}/*.zip ${OUTPUT_DIR}/*.tar.gz --clobber