36 lines
871 B
YAML
36 lines
871 B
YAML
name: Publish
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
publish:
|
|
name: Publish to crates.io
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: Install Rust
|
|
run: |
|
|
rustup override set stable
|
|
rustup update stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
- name: Verify version matches tag
|
|
run: |
|
|
CARGO_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
|
|
TAG_VERSION="${GITHUB_REF_NAME#v}"
|
|
if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then
|
|
echo "Error: Cargo.toml version ($CARGO_VERSION) doesn't match tag ($TAG_VERSION)"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Publish
|
|
run: cargo publish
|
|
env:
|
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|