Skip to content

update release

update release #2

Workflow file for this run

name: Tag Release
on:
push:
branches:
- main
permissions:
contents: write
jobs:
tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract version
id: version
run: |
version=$(grep -m1 -E '^## \\[[0-9]+\\.[0-9]+\\.[0-9]+\\]' CHANGELOG.md | sed -E 's/^## \\[([0-9]+\\.[0-9]+\\.[0-9]+)\\].*/\\1/')
if [ -z "$version" ]; then
echo "No version found in CHANGELOG.md"
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Check tag
id: tag
run: |
if git tag -l "v${{ steps.version.outputs.version }}" | grep -q .; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Create tag
if: steps.tag.outputs.exists == 'false'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "v${{ steps.version.outputs.version }}"
git push origin "v${{ steps.version.outputs.version }}"