Update to v0.5.0 #1
Workflow file for this run
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: rust-release | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
validate-release-tag: | |
name: Validate git tag | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: compare git tag with cargo metadata | |
run: | | |
PUSHED_TAG=${GITHUB_REF##*/} | |
CURR_VER=$( grep version rust/Cargo.toml | head -n 1 | awk '{print $3}' | tr -d '"' ) | |
if [[ "${PUSHED_TAG}" != "v${CURR_VER}" ]]; then | |
echo "Cargo metadata has version set to ${CURR_VER}, but got pushed tag ${PUSHED_TAG}." | |
exit 1 | |
fi | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
- name: Publish to crates.io | |
run: cargo publish --token ${CRATES_TOKEN} | |
env: | |
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} |