Skip to content

Auto Release

Auto Release #1

Workflow file for this run

name: Auto Release
on:
workflow_dispatch:
push:
branches:
- master
paths:
- 'CHANGELOG.md'
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version from CHANGELOG
id: version
run: |
VERSION=$(head -1 CHANGELOG.md | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Check if tag exists
id: check
run: |
if git rev-parse "${{ steps.version.outputs.VERSION }}" > /dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Create and push tag
if: steps.check.outputs.exists == 'false'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag ${{ steps.version.outputs.VERSION }}
git push origin ${{ steps.version.outputs.VERSION }}
- name: Create GitHub Release
if: steps.check.outputs.exists == 'false'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.VERSION }}
name: ${{ steps.version.outputs.VERSION }}
generate_release_notes: true