diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f757d11..58d10eb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -84,8 +84,20 @@ jobs: needs: [crate, wheels, pypi] if: startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'IntelliStream-DataHub' environment: release + # Job-level permissions replace the workflow's `contents: read` wholesale, so it is repeated + # here alongside the OIDC claim the auth action needs; without it `checkout` has no scope. + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@v6 + # Trades this run's OIDC identity for a crates.io token scoped to this crate and revoked in + # the action's post step, so no long-lived credential exists to leak or to expire. Requires + # a Trusted Publisher registered on the crate naming this repository, workflow and + # environment; crates.io only accepts one on a crate that already has a published version, + # which is why this could not be set up before 0.2.0 went out. + - uses: rust-lang/crates-io-auth-action@v1 + id: auth - run: cargo publish env: - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}