(Manual Release) - Bumps all packages + PR #42
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: (Manual Release) - Bumps all packages + PR | |
on: | |
workflow_dispatch: | |
inputs: | |
base: | |
description: 'Name of branch to open PR against' | |
type: 'string' | |
default: 'master' | |
version: | |
description: 'Select level for version increment' | |
type: choice | |
required: true | |
default: patch | |
options: | |
- major | |
- minor | |
- patch | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
bump-packages: | |
name: Build & Bump packages | |
runs-on: '${{ matrix.os }}' | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
steps: | |
- name: "Check if user has write access" | |
uses: "lannonbr/repo-permission-check-action@2.0.0" | |
with: | |
permission: "write" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up cargo cache | |
uses: actions/cache@v3 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- uses: actions/checkout@v3 | |
- run: | | |
git config --global user.email "Haaroon@users.noreply.github.com" | |
git config --global user.name "Haaroon" | |
- uses: ./.github/actions/setup_rust | |
name: Setup Rust | |
- name: "Install cargo release" | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: cargo-release --force | |
- name: "Bump version with cargo release" | |
uses: actions-rs/cargo@v1 | |
with: | |
command: release | |
args: --execute --no-confirm --no-publish --no-push --no-tag ${{ inputs.version }} | |
- name: "Fetch version of crate package and save to env" | |
id: set_version | |
run: | | |
echo CRATE_VERSION=$(cat Cargo.toml | grep version | head -n1 | cut -d '"' -f2) >> $GITHUB_ENV | |
echo "Crate version is $CRATE_VERSION" | |
- name: "Make a PR to bump version" | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
base: ${{ inputs.base }} | |
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
branch: ${{ env.CRATE_VERSION }} | |
commit-message: "Release v${{ env.CRATE_VERSION }}" | |
title: "Release v${{ env.CRATE_VERSION }}" | |
body: | | |
Release v${{ env.CRATE_VERSION }} | |
- [x] Publish to crates.io | |
- [x] Publish to PyPi | |
- [x] Publish to Github as release | |
- Auto-generated by [create-pull-request] triggered by release action [1] | |
[1]: https://github.com/peter-evans/create-pull-request | |