-
I would like to set a date as tag in the release-action. But how?
I get these errors:
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
You can’t use shell syntax in the
After that |
Beta Was this translation helpful? Give feedback.
-
Did not work. Getting the same validation errors.
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
The expression syntax ${{ env.NOW }} is an correct way to access the custom env, just like @airtower-luna has suggested.
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.
I tried to manually create a release, and I used the same date-time format to set the tag (e.g. 2020-06-22T02:11:39), then I got the “Invalid tag name” error. I recommend that you can reference to the “Tagging suggestions” to name the release tag. |
Beta Was this translation helpful? Give feedback.
-
Okay, thanks a lot! I just changed the pattern to:
This way the date is accepted by the release-action tag. It looks like that which satisfies my needs: v20200623.092227 |
Beta Was this translation helpful? Give feedback.
-
An update as of January 2022, when I tried to use the code mentioned above, I got a warning that GitHub deprecated the “set-env” command:
Instead, this is what I got working (note I wanted my time in the format of “2021.12.31” ):
and when using in a field somewhere, it’s the same as before, such as:
So my in the context of all my steps it looks like this, where I wanted the tags and titles to be the date:
|
Beta Was this translation helpful? Give feedback.
@mwalter,
The expression syntax ${{ env.NOW }} is an correct way to access the custom env, just like @airtower-luna has suggested.
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.