tag-release #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tag-release | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "config/version.txt" | |
workflow_dispatch: | |
jobs: | |
tag: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# using a PAT is necessary to trigger the release workflow | |
# see https://github.com/orgs/community/discussions/25702 | |
with: | |
token: ${{ secrets.SIT_BOT_PAT }} | |
- name: Get version from file | |
id: tag | |
run: | | |
export VERSION="$(cat config/version.txt)" | |
echo "tag=v$VERSION" >> $GITHUB_OUTPUT | |
- name: Check tag is new | |
run: | | |
git fetch origin --tags | |
if git tag |grep -qE ^"${{ steps.tag.outputs.tag }}"$; then | |
echo "tag already exists" | |
exit 1 | |
fi | |
- name: Create and push tag | |
run: | | |
git tag ${{ steps.tag.outputs.tag }} | |
git push --tags |