Release-plz #21
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: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
release_type: | |
description: 'Release type' | |
required: true | |
default: 'minor' | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Run tests | |
run: cargo test --all-features | |
- name: Echo | |
run: echo ${{ github.event.inputs.release_type }} | |
- name: Install | |
run: cargo install cargo-edit | |
- name: Bump new version | |
run: cargo set-version --bump ${{ github.event.inputs.release_type }} | |
- name: Save version to be reuse in subsequent runs | |
run: | | |
export VERSION=`cargo tree --depth 0 | grep rphonetic | awk '{print $2}'` | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Commit new version | |
run: | | |
git config user.name "$env.GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
git add . | |
git commit -m "Prepare ${{ env.VERSION }}" | |
git push | |
- uses: rickstaa/action-create-tag@v1 | |
with: | |
tag: ${{ env.VERSION }} | |
- name: Publish | |
shell: bash | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
run: cargo publish | |
- name: Check | |
run: cat Cargo.toml | |