next_release_tag
, which can be used to create the next release.softprops/action-gh-release
or ncipollo/release-action
to create the release.github_token
: The Github Secret GITHUB_TOKEN
or Personal Access Token
. This is a required input.
tag_prefix
: The prefix to be added to the generated release tag. Pass as ''
to remove prefix in the generated output. This is a required input.
tag_template
: A preconfigured static template based on which the new release tag will be generated. Please check the Templating System section for more information. This is a required input.
previous_tag
: Pass this to override previous tag value and not fetch previous release tag. This is an optional input.
next_release_tag
: This output variable contains the next release version and is set by the action. You can access it via step.<id>.outputs.next_release_tag
.
prev_release_tag
: Additionally, the action also sets this output variable, which contains the previous release version. You can access it via step.<id>.outputs.prev_release_tag
.
name: Create Release
on: push
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Generate release tag
id: generate_release_tag
uses: amitsingh-007/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: 'v'
tag_template: 'yyyy.mm.dd.i'
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ steps.generate_release_tag.outputs.next_release_tag }}
tag_name: ${{ steps.generate_release_tag.outputs.next_release_tag }}
token: ${{secrets.GITHUB_TOKEN}}
generate_release_notes: true
This action supports a flexible templating system with a few constraints. Users must pass the tag_template
option in the action, and the action will fill in the corresponding values based on the template to generate a new release tag. The following are the rules and constraints:
yyyy
(full year), yy
(short year), mm
(month), dd
(date), i
(iteration count).yyyy.mm.i
)..yy.mm.i.
is not allowed).yy-mm-dd.i
is not allowed).01
when any of the year, month, or date is changed between the last release and the current release.<tag_prefix><filled-in tag_template>
(e.g., if the tag_prefix is v
and the tag_template is yyyy.mm.dd.i
, then the second release on June 21, 2024, will be v2024.06.21.02
).