Prep Release #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Prep Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| bump: | |
| description: 'Version bump type' | |
| required: true | |
| default: 'patch' | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| permissions: {} | |
| jobs: | |
| create-release-pr: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Bump version and sync | |
| id: sync | |
| run: | | |
| CURRENT=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/') | |
| IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT" | |
| case "${{ inputs.bump }}" in | |
| major) MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 ;; | |
| minor) MINOR=$((MINOR + 1)); PATCH=0 ;; | |
| patch) PATCH=$((PATCH + 1)) ;; | |
| esac | |
| VERSION="${MAJOR}.${MINOR}.${PATCH}" | |
| echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT" | |
| bash scripts/version-sync.sh "$VERSION" | |
| - name: Create release branch and PR | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| VERSION="${{ steps.sync.outputs.VERSION }}" | |
| BRANCH="release/v${VERSION}" | |
| git checkout -b "$BRANCH" | |
| git add Cargo.toml npm/ pypi/ | |
| git commit -m "v${VERSION}: bump and sync package versions" | |
| git push origin "$BRANCH" | |
| gh pr create \ | |
| --title "v${VERSION}: bump and sync package versions" \ | |
| --body "## Release v${VERSION} | |
| Automated version bump (${{ inputs.bump }}). | |
| **Merge this PR to trigger the release workflow**, which will: | |
| 1. Tag the merge commit as \`v${VERSION}\` | |
| 2. Build binaries for all platforms | |
| 3. Publish to npm, crates.io, PyPI, and GitHub Releases" \ | |
| --base main \ | |
| --head "$BRANCH" |