name: Release
on:
push:
tags: ['v*']
env:
CARGO_BUILD_JOBS: 4
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Verify tag matches Cargo.toml version
run: |
tag="${GITHUB_REF_NAME#v}"
version="$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "mdcast") | .version')"
if [ "$tag" != "$version" ]; then
echo "Tag v$tag does not match Cargo.toml version $version" >&2
exit 1
fi
- name: Install pandoc
run: sudo apt-get update && sudo apt-get install -y pandoc
- uses: Swatinem/rust-cache@v2
- name: Verify (lint + check-all + test)
run: make verify
- name: Authenticate with crates.io
id: auth
uses: rust-lang/crates-io-auth-action@v1
- name: Publish
run: cargo publish --locked
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}