name: Release on: push: branches: [ master ] permissions: contents: write jobs: release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install uv uses: astral-sh/setup-uv@v6 with: enable-cache: true - name: Read version from pyproject.toml id: version run: | VERSION=$(grep '^version' pyproject.toml | head -1 | sed 's/version = "\(.*\)"/\1/') echo "version=$VERSION" >> "$GITHUB_OUTPUT" - name: Check if tag already exists id: tag_check run: | if git rev-parse "refs/tags/${{ steps.version.outputs.version }}" >/dev/null 2>&1; then echo "exists=true" >> "$GITHUB_OUTPUT" else echo "exists=false" >> "$GITHUB_OUTPUT" fi - name: Create tag and release if: steps.tag_check.outputs.exists == 'false' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | VERSION="${{ steps.version.outputs.version }}" git tag "$VERSION" git push origin "$VERSION" gh release create "$VERSION" \ --title "Release $VERSION" \ --generate-notes