Skip to content

Release

Release #1

Workflow file for this run

on:
release:
types:
- prereleased
- released
name: Release
env:
TAG: ${{ github.event.release.tag_name }}
jobs:
check-version:
name: Check Version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Version
run: |
set -ex
cargo_version="$(sed -n 's/^version\s*=\s*"\(.*\)"\s*$/\1/p' Cargo.toml)"
test "$cargo_version" = "${TAG#v}"
test:
name: Test
needs: check-version
uses: ./.github/workflows/test.yml
publish:
name: Publish
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: protoc,sccache
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
- name: Package
run: |
cargo package
- name: Publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo publish
failure:
needs: [check-version, test, publish]
if: cancelled() || failure()
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Remove tag
run: |
git push --delete origin "$TAG"