Skip to content

fix: release workflow YAML syntax and bump to 0.15.1 #7

fix: release workflow YAML syntax and bump to 0.15.1

fix: release workflow YAML syntax and bump to 0.15.1 #7

Workflow file for this run

name: Auto Release
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get version from pyproject.toml
id: version
run: |
VERSION=$(grep -m1 'version = ' pyproject.toml | cut -d'"' -f2)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version from pyproject.toml: $VERSION"
- name: Check if version already released
id: check
run: |
VERSION="${{ steps.version.outputs.version }}"
if git tag | grep -q "^v$VERSION$"; then
echo "skip=true" >> $GITHUB_OUTPUT
echo "Version v$VERSION already exists, skipping"
else
echo "skip=false" >> $GITHUB_OUTPUT
echo "Version v$VERSION not released yet"
fi
- name: Create tag and release
if: steps.check.outputs.skip == 'false'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ steps.version.outputs.version }}"
COMMIT_MSG=$(git log -1 --pretty=%B | head -1)
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git tag -a "v$VERSION" -m "Release v$VERSION"
git push origin "v$VERSION"
cat <<EOF | gh release create "v$VERSION" --title "v$VERSION" --notes-file -
## Changes
$COMMIT_MSG
---
*Auto-generated release*
EOF