Skip to content

Commit 4b9b490

Browse files
committed
chore: add workflow for dependency-track
1 parent 0938b70 commit 4b9b490

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: 'This workflow creates bill of material and uploads it to Dependency-Track each night'
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
7+
concurrency:
8+
group: ${{ github.workflow}}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
defaults:
12+
run:
13+
shell: bash
14+
15+
jobs:
16+
create-bom:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: 18.x
24+
25+
- uses: c-hive/gha-yarn-cache@v1
26+
- run: yarn install --frozen-lockfile
27+
28+
- name: Install CycloneDX CLI
29+
run: |
30+
curl -s https://api.github.com/repos/CycloneDX/cyclonedx-cli/releases/latest | grep "browser_download_url.*linux.x64" | cut -d '"' -f 4 | wget -i -
31+
sudo mv cyclonedx-linux-x64 /usr/local/bin/
32+
sudo chmod +x /usr/local/bin/cyclonedx-linux-x64
33+
- name: Generate BOMs
34+
run: |
35+
npm install -g @cyclonedx/cdxgen
36+
cdxgen -o sbom.json
37+
- name: Upload SBOM to DependencyTrack
38+
env:
39+
DEPENDENCY_TRACK_API: 'https://dt.security.dhis2.org/api/v1/bom'
40+
run: |
41+
curl -X POST "$DEPENDENCY_TRACK_API" \
42+
--fail-with-body \
43+
-H "Content-Type: multipart/form-data" \
44+
-H "X-Api-Key: ${{ secrets.DEPENDENCYTRACK_APIKEY }}" \
45+
-F "project=127b6ae4-8387-4e81-822d-f6a788150de4" \
46+

0 commit comments

Comments
 (0)