From a2c112673294e3015796f22c3c299b24468fc521 Mon Sep 17 00:00:00 2001 From: Alona Enraght-Moony Date: Sat, 30 May 2026 15:54:18 +0100 Subject: [PATCH] Setup trusted publishing to crates.io Part of https://github.com/rust-lang/rustdoc-types/issues/18 Also needs https://github.com/rust-lang/team/pull/2490 to work Sets up a workflow where tagged commits will be automatically `cargo publish`d to crates.io --- .github/workflows/release.yml | 17 +++++++++++++++++ clgen.sh | 1 - 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1e6d707 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,17 @@ +name: Publish to crates.io +on: + push: + tags: ['v*'] # Triggers when pushing tags starting with 'v' +jobs: + publish: + runs-on: ubuntu-latest + environment: release # Optional: for enhanced security + permissions: + id-token: write # Required for OIDC token exchange + steps: + - uses: actions/checkout@v6 + - uses: rust-lang/crates-io-auth-action@v1 + id: auth + - run: cargo publish + env: + CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} diff --git a/clgen.sh b/clgen.sh index bf2e6ff..0d7b9e5 100755 --- a/clgen.sh +++ b/clgen.sh @@ -62,4 +62,3 @@ echo "git add Cargo.toml CHANGELOG.md COMMIT.txt src/" echo "git commit -m $new_tag" echo "git tag $new_tag" echo "git push && git push --tags" -echo "cargo publish"