diff --git a/.github/workflows/build_all_targets.yml b/.github/workflows/build_all_targets.yml index 37ce394bd9c..243537ca604 100644 --- a/.github/workflows/build_all_targets.yml +++ b/.github/workflows/build_all_targets.yml @@ -321,6 +321,16 @@ jobs: runs-on: [runs-on,runner=1cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false] needs: [setup, group_targets] if: startsWith(github.ref, 'refs/tags/v') || contains(fromJSON('["main","stable","beta"]'), needs.group_targets.outputs.branchname) + # Job-level permissions replace the workflow-level ones, so restate them. + # id-token, attestations and artifact-metadata are for the release + # attestations below. + permissions: + contents: write + actions: read + packages: read + id-token: write + attestations: write + artifact-metadata: write outputs: uploadlocation: ${{ steps.upload-location.outputs.uploadlocation }} steps: @@ -330,6 +340,27 @@ jobs: path: artifacts/ merge-multiple: true + # Signed SLSA build provenance for every released file, verifiable with + # `gh attestation verify --repo PX4/PX4-Autopilot`. Each SBOM + # records the SHA-256 of its .px4, so the attested SBOM is bound to the + # firmware it describes. Two steps keep each under the 1024-subject limit. + - name: Attest Firmware Provenance + if: startsWith(github.ref, 'refs/tags/v') + uses: actions/attest@v4 + with: + subject-path: | + artifacts/*.px4 + artifacts/*.uavcan.bin + artifacts/*_bootloader.bin + artifacts/*_canbootloader.bin + artifacts/*.deb + + - name: Attest SBOM Provenance + if: startsWith(github.ref, 'refs/tags/v') + uses: actions/attest@v4 + with: + subject-path: artifacts/**/*.sbom.spdx.json + - name: Choose Upload Location id: upload-location run: |