Skip to content

Commit 5845370

Browse files
feat: generate SBOM and attach to release artifacts (#672)
Signed-off-by: Lukas Reining <[email protected]>
1 parent b0054f9 commit 5845370

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/release-please.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,35 @@ jobs:
1818
signoff: "OpenFeature Bot <[email protected]>"
1919
outputs:
2020
release_created: ${{ steps.release.outputs.releases_created }}
21+
all: ${{ toJSON(steps.release.outputs) }}
22+
paths_released: ${{ steps.release.outputs.paths_released }}
23+
24+
sbom:
25+
needs: release-please
26+
runs-on: ubuntu-latest
27+
if: ${{ fromJSON(needs.release-please.outputs.paths_released)[0] != null }}
28+
# Continues with the release process even if SBOM generation fails.
29+
continue-on-error: true
30+
strategy:
31+
matrix:
32+
release: ${{ fromJSON(needs.release-please.outputs.paths_released) }}
33+
env:
34+
TAG: ${{ fromJSON(needs.release-please.outputs.all)[format('{0}--tag_name', matrix.release)] }}
35+
steps:
36+
- name: Setup Node
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: 18
40+
- name: Generate SBOM
41+
run:
42+
npm install -g npm@^10.2.0
43+
npm ci --omit dev --workspace=${{matrix.release}}
44+
npm sbom --sbom-format=cyclonedx --omit=dev --omit=peer --workspace=${{matrix.release}} > bom.json
45+
- name: Attach SBOM to artifact
46+
env:
47+
GITHUB_TOKEN: ${{secrets.RELEASE_PLEASE_ACTION_TOKEN}}
48+
run:
49+
gh release upload $TAG bom.json
2150

2251
npm-release:
2352
needs: release-please

0 commit comments

Comments
 (0)