Skip to content

Create tag

Create tag #32

name: Create tag
on:
workflow_dispatch:
env:
GIT_CHGLOG_VERSION: "0.15.4"
SVU_VERSION: "1.12.0"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Fetches entire history, so we can analyze commits since last tag
fetch-depth: 0
persist-credentials: true
fetch-tags: true
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.CREATE_TAG_GITHUB_TOKEN }}
- uses: Bpazy/setup-git-chglog@v1
with:
git-chglog-version: ${{ env.GIT_CHGLOG_VERSION}}
- uses: obfu5c8/action-svu@v1
id: install_svu
with:
type: none
svu-version: ${{ env.SVU_VERSION}}
- name: get version
id: get_version
run: |
current_version="$(svu current --tag-mode current-branch --strip-prefix)"
prerelease_version="$(svu prerelease --tag-mode all-branches --strip-prefix --pre-release prerelease)"
release_version="$(svu next --tag-mode all-branches --strip-prefix)"
echo "CURRENT_VERSION=${current_version}" >> $GITHUB_OUTPUT
echo "PRERELEASE_VERSION=${prerelease_version}" >> $GITHUB_OUTPUT
echo "RELEASE_VERSION=${release_version}" >> $GITHUB_OUTPUT
echo "current version: ${current_version}"
echo "prerelease version: ${prerelease_version}"
echo "release version: ${release_version}"
- name: generate change log for release
run: |
git-chglog --next-tag "v${{ steps.get_version.outputs.RELEASE_VERSION }}" > CHANGELOG.md
- name: Add updated changelog and create tag
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "chore(release): v${{ steps.get_version.outputs.RELEASE_VERSION }}"
add: "CHANGELOG.md"
tag: "v${{ steps.get_version.outputs.RELEASE_VERSION }}"
tag_push: '--force'