From a273c249c32f40c6f6837d08cbc1e40d314f77ca Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sat, 18 Jul 2026 14:54:25 -0500 Subject: [PATCH] ci: publish to crates.io via OIDC Trusted Publishing (no token) Replaces CARGO_TOKEN with crates.io Trusted Publishing: id-token: write + rust-lang/crates-io-auth-action exchanges the OIDC token for a short-lived crates.io token. Requires a trusted publisher configured on crates.io (Expressive-Tea/matcha, release.yml). Signed-off-by: Diego Resendez --- .github/workflows/release.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6d89510..d74412f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -83,16 +83,23 @@ jobs: matcha-${{ matrix.target }}.tar.gz.sha256 # crates.io = production only. + # crates.io = production only, via OIDC Trusted Publishing (no CARGO_TOKEN). + # Requires a trusted publisher configured on crates.io (Expressive-Tea/matcha, release.yml). publish-crate: if: ${{ github.server_url == 'https://github.com' }} runs-on: ubuntu-latest + permissions: + id-token: write steps: - uses: actions/checkout@v4 - name: Install Rust run: | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" + # Exchanges the OIDC id-token for a short-lived crates.io token. + - uses: rust-lang/crates-io-auth-action@v1 + id: auth - name: cargo publish env: - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }} + CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} run: cargo publish --locked -- 2.54.1