betterwithage's picture
mirror github.com/szl-holdings/amaru@779a0d7e4e69
a8b4b87 verified
name: SLSA Level 3 Provenance
# Generates SLSA Level 3 provenance attestation for release artifacts.
# The attestation (.intoto.jsonl) is uploaded alongside release assets,
# providing cryptographically verifiable build provenance for Series-A
# supply-chain diligence and downstream consumer verification.
#
# SLSA generator pinned to slsa-framework/slsa-github-generator v2.1.0
# commit SHA: f7dd8c54c2067bafc12ca7a55595d5ee9b75204a (2025-02-24)
#
# IMPORTANT: This workflow changes release behavior — it generates a
# provenance attestation for every published release. Founder review
# required before merge.
#
# Verification: consumers can verify with:
# slsa-verifier verify-artifact <artifact> \
# --provenance-path <artifact>.intoto.jsonl \
# --source-uri github.com/szl-holdings/amaru
on:
release:
types: [published]
permissions:
id-token: write # Required for SLSA provenance signing
contents: write # Required to upload attestation to release
actions: read # Required by SLSA generator to read workflow
jobs:
# ---------------------------------------------------------------------------
# 1. Build the release artifact and compute its hash.
# ---------------------------------------------------------------------------
build:
name: Build release artifact
runs-on: ubuntu-latest
outputs:
artifact-name: ${{ steps.set-output.outputs.artifact-name }}
artifact-sha256: ${{ steps.hash.outputs.sha256 }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Create release archive
id: set-output
run: |
set -euo pipefail
ARTIFACT="amaru-${{ github.event.release.tag_name }}.tar.gz"
# Package the repo source (adjust for language-specific build output)
git archive --format=tar.gz \
--prefix="amaru-${{ github.event.release.tag_name }}/" \
HEAD \
-o "$ARTIFACT"
echo "artifact-name=$ARTIFACT" >> "$GITHUB_OUTPUT"
- name: Compute SHA-256
id: hash
run: |
set -euo pipefail
ARTIFACT="${{ steps.set-output.outputs.artifact-name }}"
SHA=$(sha256sum "$ARTIFACT" | awk '{print $1}')
echo "sha256=$SHA" >> "$GITHUB_OUTPUT"
echo "Artifact: $ARTIFACT"
echo "SHA256: $SHA"
- name: Upload artifact for provenance job
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: release-artifact
path: ${{ steps.set-output.outputs.artifact-name }}
retention-days: 1
if-no-files-found: error
# ---------------------------------------------------------------------------
# 2. Generate SLSA Level 3 provenance attestation.
# This is a reusable workflow call — it runs in a separate job with
# hermetic build environment verification.
# ---------------------------------------------------------------------------
provenance:
name: Generate SLSA provenance
needs: [build]
permissions:
id-token: write
contents: write
actions: read
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@f7dd8c54c2067bafc12ca7a55595d5ee9b75204a
with:
base64-subjects: ${{ needs.build.outputs.artifact-sha256 }}
upload-assets: true
provenance-name: amaru-${{ github.event.release.tag_name }}.intoto.jsonl