Skip to content

Commit af1ca5b

Browse files
committed
feat(ci): add sbom generation
Signed-off-by: Travis Truman <trumant@gmail.com>
1 parent 41d7404 commit af1ca5b

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ jobs:
3333
uses: actions/setup-go@v5
3434
with:
3535
go-version: 1.23.4
36+
- name: Install Syft
37+
uses: anchore/sbom-action/download-syft@f8bdd1d8ac5e901a77a92f111440fdb1b593736b
38+
with:
39+
syft-version: v1.33.0
3640
- name: Run GoReleaser
3741
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a
3842
with:
@@ -45,3 +49,8 @@ jobs:
4549
uses: actions/attest-build-provenance@v3
4650
with:
4751
subject-checksums: dist/checksums.txt
52+
- name: Attest SBOMs
53+
uses: actions/attest-sbom@v3
54+
with:
55+
subject-checksums: dist/checksums.txt
56+
sbom-path: 'dist/pvtr-github-repo_*.tar.gz.spdx.json'

.goreleaser.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,60 @@ checksum:
4848
release:
4949
prerelease: auto
5050

51+
sboms:
52+
- # ID of the sbom config, must be unique.
53+
#
54+
# Default: 'default'.
55+
id: sboms
56+
57+
# List of names of the SBOM documents created at this step
58+
# (relative to the dist dir).
59+
#
60+
# Each element configured is made available as variables. For example:
61+
# documents: ["foo", "bar"]
62+
#
63+
# would make the following variables that can be referenced as template keys:
64+
# document0: "foo"
65+
# document1: "bar"
66+
#
67+
# Note that multiple sbom values are only allowed if the value of
68+
# "artifacts" is "any".
69+
#
70+
# Default:
71+
# When "binary": ["{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}.sbom.json"]
72+
# When "any": []
73+
# Otherwise: ["{{ .ArtifactName }}.sbom.json"]
74+
# Templates: allowed.
75+
documents:
76+
- "${artifact}.spdx.json"
77+
78+
# Path to the SBOM generator command
79+
#
80+
# Note: the process CWD will be set to the same location as "dist"
81+
#
82+
# Default: 'syft'.
83+
cmd: syft
84+
85+
# Command line arguments for the command
86+
#
87+
# Default: ["$artifact", "--output", "spdx-json=$document", "--enrich", "all"].
88+
# Templates: allowed.
89+
# args: ["$artifact", "--output", "cyclonedx-json=$document"]
90+
91+
# Which artifacts to catalog.
92+
#
93+
# Valid options are:
94+
# - any: let the SBOM tool decide which artifacts available in
95+
# the cwd should be cataloged
96+
# - source: source archive
97+
# - package: Linux packages (deb, rpm, apk, etc)
98+
# - installer: Windows MSI installers (Pro only)
99+
# - diskimage: macOS DMG disk images (Pro only)
100+
# - archive: archives from archive pipe
101+
# - binary: binaries output from the build stage
102+
#
103+
# Default: 'archive'.
104+
artifacts: archive
105+
51106
universal_binaries:
52107
- replace: true

0 commit comments

Comments
 (0)