Skip to content

v0.12.6

v0.12.6 #20

# SPDX-FileCopyrightText: RAprogramm <andrey.rozanov.vl@gmail.com>
# SPDX-License-Identifier: MIT
# On every published GitHub release, generate a CycloneDX SBOM and a
# signed SLSA build-provenance attestation for the `.crate` artefact
# that release-plz published to crates.io, then attach the SBOM, the
# Sigstore provenance bundle, and the crate itself to the release so
# consumers can run `gh attestation verify` against them and supply-chain
# scanners (e.g. OpenSSF Scorecard Signed-Releases) can see the signature.
name: Release attestations
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: Tag to re-attest (e.g. v0.10.0)
required: true
type: string
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.release.tag_name || inputs.tag }}
cancel-in-progress: false
jobs:
attest:
name: Generate SBOM and provenance
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
id-token: write
attestations: write
steps:
- name: Checkout tagged commit
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.release.tag_name || inputs.tag }}
fetch-depth: 0
persist-credentials: false
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@2c7215f132e9ebf062739d9130488b56d53c060c # master
with:
toolchain: stable
- name: Load cached target directory
uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
key: release-attestations
save-if: false
- name: Package crate
run: cargo package --no-verify --allow-dirty
- name: Locate .crate file
id: artefact
run: |
set -euo pipefail
crate=$(find target/package -maxdepth 1 -name '*.crate' -print -quit)
if [ -z "$crate" ]; then
echo "::error::No .crate file produced under target/package" >&2
exit 1
fi
echo "path=$crate" >> "$GITHUB_OUTPUT"
echo "name=$(basename "$crate")" >> "$GITHUB_OUTPUT"
- name: Generate CycloneDX SBOM
uses: anchore/sbom-action@e22c389904149dbc22b58101806040fa8d37a610 # v0
with:
path: ./
format: cyclonedx-json
output-file: yew-nav-link-sbom.cdx.json
upload-artifact: false
upload-release-assets: false
- name: Generate build provenance attestation
id: attest
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
with:
subject-path: |
${{ steps.artefact.outputs.path }}
yew-nav-link-sbom.cdx.json
- name: Attach SBOM, provenance bundle, and crate to GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.event.release.tag_name || inputs.tag }}
BUNDLE: ${{ steps.attest.outputs.bundle-path }}
CRATE: ${{ steps.artefact.outputs.path }}
run: |
set -euo pipefail
cp "$BUNDLE" yew-nav-link-provenance.sigstore.json
gh release upload "$TAG" \
yew-nav-link-sbom.cdx.json \
yew-nav-link-provenance.sigstore.json \
"$CRATE" \
--clobber