Skip to content

How to set a date as tag in release-action? #25766

Answered by BrightRan
mwalter asked this question in Actions
Discussion options

You must be logged in to vote

@mwalter,

The expression syntax ${{ env.NOW }} is an correct way to access the custom env, just like @airtower-luna has suggested.

steps:
  - name: set env
    run: echo "::set-env name=NOW::$(date +'%Y-%m-%dT%H:%M:%S')"
  • name: create release
    uses: ncipollo/release-action@v1
    with:
    artifacts: my-artifact
    tag: ${{ env.NOW }}
    token: ${{ secrets.GITHUB_TOKEN }}

This expression can correctly pass the value of env.NOW into the action “ncipollo/release-action@v1”.

The root cause of you still get the invalid tag_name error is that the format (DateTime) of the tag_name you set is not supported on GitHub.

Errors:
- tag_name is not a valid tag
- tag_name is not well-formed
- Published releases must…

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

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