I hope to automatically create a new release through Actions and set the name to the current time, but I have failed many times. How can I do this?
Just like this
Assuming your build is running on Linux, you can just use the date
command in a step, e.g:
- name: set release date
run: |
echo "RELEASE_DATE=$(date --rfc-3339=date)" >> ${GITHUB_ENV}
That’ll give you the current date in YYYY-MM-DD format, adjust the date
command line if you need another format.
3 Likes
It looks like you’re sending the date into ${TIME}
instead of $GITHUB_ENV
. To set an environment variable you need to send it to $GITHUB_ENV
in the following format:
echo "{name}={value}" >> $GITHUB_ENV
4 Likes
It still have some problem.
You’ll likely need to wrap it in an expression syntax, otherwise it’ll just output as a string:
${{ env.TIME }}
2 Likes