Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot set tag_name from env variable #360

Closed
RunningLeon opened this issue May 29, 2023 · 2 comments
Closed

cannot set tag_name from env variable #360

RunningLeon opened this issue May 29, 2023 · 2 comments

Comments

@RunningLeon
Copy link

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
@kevinmatthes
Copy link

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants