Open a release PR #22
This file contains 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@v3 | |
- uses: chainguard-dev/actions/setup-gitsign@main | |
- name: Install cargo-release | |
uses: taiki-e/install-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tool: cargo-release | |
- 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: 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 }} |