name: Publish to crates.io
on:
workflow_call:
inputs:
plan:
description: dist-manifest JSON for this announcement
required: true
type: string
permissions:
contents: read
jobs:
publish:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Verify the bumped Cargo.toml version matches the release tag
env:
PLAN: ${{ inputs.plan }}
run: |
tag_version=$(echo "$PLAN" | jq -r '.releases[0].app_version')
cargo_version=$(cargo metadata --no-deps --format-version 1 \
| jq -r '.packages[] | select(.name == "quicknode-cli") | .version')
if [[ "$tag_version" != "$cargo_version" ]]; then
echo "Error: tag version ($tag_version) does not match Cargo.toml version ($cargo_version)." >&2
echo "This indicates the release-bump step was skipped or the wrong commit was tagged." >&2
exit 1
fi
echo "Version check passed: $tag_version"
- uses: dtolnay/rust-toolchain@stable
- name: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish -p quicknode-cli