Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/release-finalize.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Finalize Release

on:
push:
branches:
- main
paths:
- 'pyproject.toml'

jobs:
finalize:
# Only run if this is a version bump commit
if: contains(github.event.head_commit.message, 'Bump version to')
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get version from pyproject.toml
id: get_version
run: |
VERSION=$(grep '^version = ' pyproject.toml | cut -d'"' -f2)
echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Create annotated tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "v${{ steps.get_version.outputs.version }}" \
-m "Release version ${{ steps.get_version.outputs.version }}"

- name: Push tag
run: |
git push origin refs/tags/v${{ steps.get_version.outputs.version }}

- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "v${{ steps.get_version.outputs.version }}" \
--title "Release v${{ steps.get_version.outputs.version }}" \
--notes "Release v${{ steps.get_version.outputs.version }}" \
--latest

- name: Delete release branch
continue-on-error: true
run: |
BRANCH_NAME="release/v${{ steps.get_version.outputs.version }}"
git push origin --delete "$BRANCH_NAME"
57 changes: 39 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create Release
name: Create Release PR

on:
workflow_dispatch:
Expand Down Expand Up @@ -28,6 +28,7 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write # Needed to push commits and tags
pull-requests: write # Needed to create pull requests

steps:
- name: Checkout code
Expand Down Expand Up @@ -64,25 +65,45 @@ jobs:
git add pyproject.toml
git commit -m "Bump version to ${{ steps.bump_version.outputs.new_version }}"

- name: Create annotated tag
- name: Create release branch
id: create_branch
run: |
git tag -a "v${{ steps.bump_version.outputs.new_version }}" \
-m "Release version ${{ steps.bump_version.outputs.new_version }}"
BRANCH_NAME="release/v${{ steps.bump_version.outputs.new_version }}"
git checkout -b "$BRANCH_NAME"
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT

- name: Push changes and tag
- name: Push release branch
run: |
git push origin main
git push origin refs/tags/v${{ steps.bump_version.outputs.new_version }}
git push origin ${{ steps.create_branch.outputs.branch_name }}

- name: Create GitHub Release
uses: actions/create-release@v1
- name: Create Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Auto-provided by GitHub
with:
tag_name: v${{ steps.bump_version.outputs.new_version }}
release_name: Release v${{ steps.bump_version.outputs.new_version }}
body: |
Version bumped from ${{ steps.current_version.outputs.version }}
to ${{ steps.bump_version.outputs.new_version }}
draft: false
prerelease: false
GH_TOKEN: ${{ github.token }}
run: |
gh pr create \
--base main \
--head ${{ steps.create_branch.outputs.branch_name }} \
--title "Release v${{ steps.bump_version.outputs.new_version }}" \
--body "## Release v${{ steps.bump_version.outputs.new_version }}

This PR bumps the version from ${{ steps.current_version.outputs.version }} to ${{ steps.bump_version.outputs.new_version }}.

### Pre-merge Checklist
- [ ] All tests pass
- [ ] All lint checks pass
- [ ] Version bump is correct

### Post-merge Actions
Once merged, the following will happen automatically:
1. Git tag \`v${{ steps.bump_version.outputs.new_version }}\` will be created
2. GitHub release will be published
3. PyPI publish workflow will trigger

---
🤖 This PR was created automatically by the release workflow" \
--label "release"

- name: Output PR info
run: |
echo "✅ Release PR created successfully!"
echo "Review and merge the PR to finalize the release."