Skip to content

Commit 24dfe3c

Browse files
ci: add release artifact attestation
1 parent b52f032 commit 24dfe3c

File tree

2 files changed

+82
-5
lines changed

2 files changed

+82
-5
lines changed

.github/workflows/ci.yml

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,25 @@ name: Build & Test
22

33
on:
44
workflow_call:
5+
inputs:
6+
attestation:
7+
type: boolean
8+
description: 'Attest artifacts'
9+
required: false
10+
default: false
511
outputs:
612
version_number:
7-
description: "Build version number"
8-
value: ${{ jobs.build.outputs.version_number }}
13+
description: "Build version number"
14+
value: ${{ jobs.build.outputs.version_number }}
15+
setup_attestation_url:
16+
description: "Setup attestation url"
17+
value: ${{ jobs.build.outputs.setup_attestation_url }}
18+
sbom_framework_dependent_attestation_url:
19+
description: "SBOM framework dependent attestation url"
20+
value: ${{ jobs.build.outputs.sbom_framework_dependent_attestation_url }}
21+
sbom_standalone_attestation_url:
22+
description: "SBOM standalone attestation url"
23+
value: ${{ jobs.build.outputs.sbom_standalone_attestation_url }}
924
push:
1025
branches: [ master ]
1126
paths:
@@ -23,12 +38,20 @@ on:
2338
- 'AutoStartConfirmTests/**'
2439
- '.github/workflows/**'
2540

41+
permissions:
42+
id-token: write
43+
contents: read
44+
attestations: write
45+
2646
jobs:
2747
build:
2848
runs-on: windows-latest
2949

3050
outputs:
31-
version_number: ${{ steps.get-version-number.outputs.version_number }}
51+
version_number: ${{ steps.get-version-number.outputs.version_number }}
52+
setup_attestation_url: ${{ steps.setup-attestation.outputs.attestation-url }}
53+
sbom_framework_dependent_attestation_url: ${{ steps.sbom-framework-dependent-attestation.outputs.attestation-url }}
54+
sbom_standalone_attestation_url: ${{ steps.sbom-standalone-attestation.outputs.attestation-url }}
3255

3356
steps:
3457
- uses: actions/checkout@v4
@@ -96,3 +119,40 @@ jobs:
96119
name: AutoStartConfirmSetup
97120
path: build\publish\*.msi
98121
if-no-files-found: error
122+
123+
- name: Generate framework dependent SBOM
124+
uses: anchore/sbom-action@v0
125+
with:
126+
artifact-name: FrameworkDependent.sbom.spdx.json
127+
output-file: FrameworkDependent.sbom.spdx.json
128+
file: ./Build/publish/Release_FrameworkDependent_win-x64/AutoStartConfirm.deps.json
129+
130+
- name: Generate standalone SBOM
131+
uses: anchore/sbom-action@v0
132+
with:
133+
artifact-name: Standalone.sbom.spdx.json
134+
output-file: Standalone.sbom.spdx.json
135+
file: ./Build/publish/Release_Standalone_win-x64/AutoStartConfirm.deps.json
136+
137+
- name: Generate artifact attestation
138+
if: ${{ inputs.attestation }}
139+
id: setup-attestation
140+
uses: actions/attest-build-provenance@v2
141+
with:
142+
subject-path: build\publish\*.msi
143+
144+
- name: Generate framework dependent SBOM attestation
145+
if: ${{ inputs.attestation }}
146+
id: sbom-framework-dependent-attestation
147+
uses: actions/attest-sbom@v1
148+
with:
149+
subject-path: build\publish\AutoStartConfirmSetup_FrameworkDependent.msi
150+
sbom-path: FrameworkDependent.sbom.spdx.json
151+
152+
- name: Generate standalone SBOM attestation
153+
if: ${{ inputs.attestation }}
154+
id: sbom-standalone-attestation
155+
uses: actions/attest-sbom@v1
156+
with:
157+
subject-path: build\publish\AutoStartConfirmSetup_Standalone.msi
158+
sbom-path: Standalone.sbom.spdx.json

.github/workflows/create-release.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@ name: Create release
33
on:
44
workflow_dispatch:
55

6+
permissions:
7+
attestations: write
8+
contents: write
9+
id-token: write
10+
611
jobs:
712
build:
813
uses: ./.github/workflows/ci.yml
14+
with:
15+
attestation: true
916

1017
create_release:
1118
needs: build
@@ -17,16 +24,26 @@ jobs:
1724
- name: Checkout
1825
uses: actions/checkout@v4
1926

20-
- name: Download build artifact
27+
- name: Download setup artifact
2128
uses: actions/download-artifact@v4.1.8
2229
with:
2330
name: AutoStartConfirmSetup
31+
32+
- name: Download framework dependent SBOM artifact
33+
uses: actions/download-artifact@v4.1.8
34+
with:
35+
name: FrameworkDependent.sbom.spdx.json
36+
37+
- name: Download standalone SBOM artifact
38+
uses: actions/download-artifact@v4.1.8
39+
with:
40+
name: Standalone.sbom.spdx.json
2441

2542
- name: Create tag and release
2643
run: |
2744
$v = "${{needs.build.outputs.version_number}}" -split "\."
2845
$semver = ($v | Select-Object -SkipLast 1) -join "."
29-
gh release create "v$semver" -d -p --title "$semver" --generate-notes AutoStartConfirmSetup_Standalone.msi AutoStartConfirmSetup_FrameworkDependent.msi
46+
gh release create "v$semver" -d -p --title "$semver" --generate-notes AutoStartConfirmSetup_Standalone.msi AutoStartConfirmSetup_FrameworkDependent.msi Standalone.sbom.spdx.json FrameworkDependent.sbom.spdx.json
3047
env:
3148
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3249
shell: pwsh

0 commit comments

Comments
 (0)