Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish to crates.io

# Publishes the crate when a version tag (v*) is pushed.
# Auth uses crates.io Trusted Publishing (OIDC) — no long-lived token is
# stored in GitHub. One-time setup on crates.io: add a Trusted Publisher for
# this repository pointing at this workflow file (publish.yml).

on:
push:
tags:
- "v*"

jobs:
publish:
runs-on: ubuntu-latest
permissions:
# Required for Trusted Publishing: the OIDC token exchange with crates.io.
id-token: write
contents: read
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable

- name: Verify tag matches Cargo.toml version
run: |
TAG="${GITHUB_REF_NAME#v}"
CRATE_VER="$(grep -m1 '^version' Cargo.toml | sed -E 's/.*"(.*)".*/\1/')"
echo "tag=$TAG crate=$CRATE_VER"
if [ "$TAG" != "$CRATE_VER" ]; then
echo "::error::tag v$TAG does not match Cargo.toml version $CRATE_VER"
exit 1
fi

- name: Authenticate to crates.io (Trusted Publishing)
uses: rust-lang/crates-io-auth-action@v1
id: auth

- name: Publish
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Cargo.lock

# Local-only design/plan docs (not part of the published crate)
/.plans/
/docs/superpowers/

# JetBrains IDE files
/.idea/

# Local-only tooling scratch (not part of the published crate)
/.superpowers/
Expand Down
Loading