File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build and Upload SBOMs to Dependency-Track
2+
3+ on :
4+ workflow_dispatch :
5+ push :
6+ branches :
7+ - main
8+
9+ jobs :
10+ sbom :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - name : Checkout code
14+ uses : actions/checkout@v5
15+
16+ # Node.js SBOM
17+ - name : Use Node.js
18+ uses : actions/setup-node@v6
19+ with :
20+ node-version-file : .nvmrc
21+ check-latest : true
22+ cache : ' npm'
23+
24+ - name : Install CycloneDX Node.js CLI
25+ run : npm i -g @cyclonedx/cyclonedx-npm
26+
27+ - name : Generate SBOM for Node.js (frontend)
28+ run : npx @cyclonedx/cyclonedx-npm -o sbom.xml
29+
30+ # Upload Node.js SBOM (if exists)
31+ - name : Upload Node.js SBOM to Dependency-Track
32+ env :
33+ DTRACK_API_KEY : ${{ secrets.DTRACK_API_KEY }}
34+ run : |
35+ if [ -f ./sbom.xml ]; then
36+ curl --fail-with-body -v -i -w "\nHTTP Status: %{http_code}\n" \
37+ -X POST "$DTRACK_API_URI" \
38+ -H "X-Api-Key: $DTRACK_API_KEY" \
39+ -H "accept: application/json" \
40+ -H "Content-Type: multipart/form-data" \
41+ -F "autoCreate=true" \
42+ -F "projectName=${{ github.event.repository.name }}" \
43+ -F "projectVersion=${{ github.ref_name }}" \
44+ -F "bom=@./sbom.xml"
45+ else
46+ echo "No frontend SBOM to upload."
47+ fi
You can’t perform that action at this time.
0 commit comments