Skip to content

Create Release PR

Create Release PR #7

Workflow file for this run

# https://zenn.dev/linnefromice/articles/gh-actions-auto-crate-versionup
name: Create Release PR
on:
workflow_dispatch:
inputs:
level_or_version:
description: 'Release level or version, e.g patch, minor, major, 1.0.0'
type: string
env:
RUST_VERSION: 1.79.0
DEFAULT_RELEASE_LEVEL: patch
BASE_BRANCH_NAME: release
jobs:
create-release-pr:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
name: Release
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Checkout the source code
uses: actions/checkout@v3
- name: Install Rust
run: |
rustup update ${{ env.RUST_VERSION }} --no-self-update
rustup default ${{ env.RUST_VERSION }}
- name: Install cargo-release
run: |
curl -LsSf https://github.com/crate-ci/cargo-release/releases/download/v0.25.10/cargo-release-v0.25.10-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ${CARGO_HOME:-~/.cargo}/bin
- name: Setup Git
run: |
git config --global user.name "${{ github.actor }}"
git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
git fetch --unshallow
git fetch --tags
- name: Run cargo release
run: |
cargo release version --execute --no-confirm ${{ github.event.inputs.level_or_version || env.DEFAULT_RELEASE_LEVEL }}
PKG_VER=$(cargo metadata --format-version=1 --no-deps | jq ".packages[0].version" | tr -d '"')
git checkout -b ${{ env.BASE_BRANCH_NAME }}/$PKG_VER
cargo release commit --verbose --execute --no-confirm
git push -u origin HEAD
- name: Create pull request
run:
gh pr create --fill
# gh pr merge --auto