[CI] Publish attestation bundles with release assets (#25220) [OpenSSF Scorecard's Signed-Releases](https://github.com/ossf/scorecard/blob/main/docs/checks.md#signed-releases) looks at the names of release assets. It does not query GitHub's attestation API. A release counts as signed one of its assets is a `.sigstore.json` file, so upload the Sigstore bundle of each build job with the files it covers. The bundles also let users and mirrors verify the assets offline, without GitHub's attestation API: gh attestation verify <file> --bundle <bundle>.sigstore.json \ --repo iree-org/iree \ --signer-workflow iree-org/iree/.github/workflows/build_package.yml --------- Signed-off-by: Tobias Fuchs <fuchs@roofline.ai> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index e5745e9..c4138e5 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml
@@ -355,14 +355,34 @@ path: ./bindist/* retention-days: 5 - # Attest the same files that are uploaded as release assets below, so - # users can verify them with `gh attestation verify`. + # Attest the ./bindist files that are uploaded as release assets below, + # so users can verify them with `gh attestation verify`. - name: Attest Release Assets + id: attest if: github.event.inputs.release_id != '' uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2 with: subject-path: ./bindist/iree*.* + # Publish the attestation as a Sigstore bundle next to the files it + # covers, so that it can be verified offline with + # `gh attestation verify --bundle` and is found by the OpenSSF Scorecard + # Signed-Releases check, which only looks at release assets. The Linux + # container builds create ./bindist as root, so the bundle is staged in + # the runner's temp directory instead. + - name: Stage Attestation Bundle + if: steps.attest.outcome == 'success' + shell: bash + env: + BUNDLE_PATH: ${{ steps.attest.outputs.bundle-path }} + PACKAGE_VERSION: ${{ github.event.inputs.package_version }} + BUILD_FAMILY: ${{ matrix.build-family }} + BUILD_PACKAGE: ${{ matrix.build-package }} + run: | + mkdir -p "${RUNNER_TEMP}/attestation" + cp "${BUNDLE_PATH}" \ + "${RUNNER_TEMP}/attestation/iree-${PACKAGE_VERSION}-${BUILD_FAMILY}-${BUILD_PACKAGE}.sigstore.json" + # TODO: Upload the tar.bz2 files too when ready - name: Upload Release Assets if: github.event.inputs.release_id != '' @@ -372,8 +392,10 @@ GITHUB_TOKEN: ${{ secrets.WRITE_ACCESS_TOKEN }} with: release_id: ${{ github.event.inputs.release_id }} - # Only upload iree artifacts. - assets_path: ./bindist/iree*.* + # Only upload iree artifacts and their attestation bundle. + assets_path: | + ./bindist/iree*.* + ${{ runner.temp }}/attestation/*.sigstore.json validate_and_publish: name: "Trigger validate and publish release"
diff --git a/docs/website/docs/developers/general/release-management.md b/docs/website/docs/developers/general/release-management.md index ac9970a..71c4721 100644 --- a/docs/website/docs/developers/general/release-management.md +++ b/docs/website/docs/developers/general/release-management.md
@@ -331,6 +331,16 @@ "${WHEEL_DIR}"/*.whl "${WHEEL_DIR}"/iree-dist-*.tar.xz ``` + * Upload the candidate's attestation bundles for the `iree-dist-*.tar.xz` + files + + ```bash + gh release download iree-3.1.0rc20241119 --repo iree-org/iree \ + --pattern '*-main-dist-linux.sigstore.json' --dir "${WHEEL_DIR}" + gh release upload v3.1.0 --repo iree-org/iree \ + "${WHEEL_DIR}"/*-main-dist-linux.sigstore.json + ``` + * Publish the release. Uncheck the option for "pre-release", and check the option for "latest" and hit publish.