Open a release PR #38
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: Open a release PR | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| level: | |
| description: Version bump level | |
| required: true | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| jobs: | |
| make-release-pr: | |
| permissions: | |
| id-token: write # Enable OIDC | |
| pull-requests: write | |
| contents: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - uses: chainguard-dev/actions/setup-gitsign@main | |
| - uses: cargo-bins/cargo-binstall@main | |
| - name: Install cargo-release | |
| run: cargo binstall cargo-release -y | |
| - name: Update versions | |
| id: update_versions | |
| run: | | |
| OLD_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -rc '.packages[] | select(.name=="worker") | .version') | |
| cargo release version ${{ inputs.level }} --execute --no-confirm | |
| cargo update | |
| NEW_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -rc '.packages[] | select(.name=="worker") | .version') | |
| find templates | grep Cargo.toml | while read f; do sed -i -e "s/$OLD_VERSION/$NEW_VERSION/g" $f; done | |
| echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Remove local patch references | |
| run: | | |
| sed -i 's|, path = "./wasm-bindgen[^"]*"||g' Cargo.toml | |
| sed -i '/\[patch\.crates-io\]/,$d' Cargo.toml | |
| - name: Check semver | |
| uses: obi1kenobi/cargo-semver-checks-action@v2 | |
| continue-on-error: true | |
| with: | |
| package: worker | |
| verbose: true | |
| feature-group: default-features | |
| - name: Check semver (http) | |
| uses: obi1kenobi/cargo-semver-checks-action@v2 | |
| continue-on-error: true | |
| with: | |
| package: worker | |
| verbose: true | |
| - name: Build workspace | |
| run: cargo build --workspace | |
| - name: Build workspace (http) | |
| run: cargo build --package worker-sandbox --all-features | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| commit-message: "chore: bump versions" | |
| branch: releases/v${{ steps.update_versions.outputs.version }} | |
| base: main | |
| title: Release v${{ steps.update_versions.outputs.version }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |