Skip to content

Commit af2704d

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

File tree

1 file changed

+50
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)