Skip to content

Prepare Release

Prepare Release #2

name: Prepare Release
on:
workflow_dispatch:
inputs:
level:
type: choice
description: Version to release
required: true
options:
- patch
- minor
- major
# - release
# - rc
# - beta
# - alpha
jobs:
make-release-pr:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
# cache cargo release so we don't have to install it every time
- name: Cache cargo release and rust install steps
id: cache-release
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/target/
key: ${{ runner.os }}-cargo-release
- uses: actions/checkout@v4
- name: Install cargo-release
if: steps.cache-release.outputs.cache-hit != 'true'
run: cargo install cargo-release
- name: Setup Git info
run: |
git config user.name "Github Actions: Release"
git config user.email "<>"
- name: Bump version
run: |
# --no-publish: do not publish to crates.io
# --no-tag: do not push tag for each new version
# --no-push: do not push the update commits
# --execute: not a dry run
cargo release ${{ inputs.level }} \
--no-publish \
--no-tag \
--no-push \
--no-confirm \
--execute
- name: Get package version
id: cargo-get
uses: nicolaiunrein/cargo-get@master
with:
subcommand: package.version
- name: Create PR
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.PAT }}
delete-branch: true
base: "main"
branch: "release/${{ steps.cargo-get.outputs.metadata }}"
labels: "C-Release"
title: "Preparing Release ${{ steps.cargo-get.outputs.metadata }}"
body: |
Preparing the release of `${{ steps.cargo-get.outputs.metadata }}`
This PR has been auto-generated