-
Notifications
You must be signed in to change notification settings - Fork 127
59 lines (52 loc) · 1.63 KB
/
generate-sbom.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Generate and upload SBOM
on:
push:
branches:
- qa/**
- stable/**
jobs:
generate-sbom:
runs-on: ubuntu-latest
container:
image: aquasec/trivy:latest
options: --entrypoint ""
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up cache
uses: actions/cache@v4
with:
path: .trivycache/
key: ${{ runner.os }}-trivy-${{ hashFiles('package-lock.json', 'composer.lock') }}
restore-keys: |
${{ runner.os }}-trivy-
- name: Generate SBOM
run: trivy fs --cache-dir .trivycache --format cyclonedx --include-dev-deps --output sbom.xml .
env:
TRIVY_NO_PROGRESS: "true"
- name: Upload SBOM artifact
uses: actions/upload-artifact@v4
with:
name: sbom
path: sbom.xml
upload-sbom:
needs: generate-sbom
runs-on: ubuntu-latest
steps:
- name: Download SBOM artifact
uses: actions/download-artifact@v4
with:
name: sbom
- name: Upload SBOM
run: |
curl -v -X 'POST' "${{ secrets.DEPENDENCY_TRACK_URL }}/api/v1/bom" \
-H "X-Api-Key: ${{ secrets.DEPENDENCY_TRACK_API_KEY }}" \
-H "Content-Type: multipart/form-data" \
-F "autoCreate=true" \
-F "projectName=${{ github.repository }}" \
-F "projectVersion=${{ github.ref_name }}" \
-F "parentName=AtoM" \
-F "[email protected]"
env:
DEPENDENCY_TRACK_URL: ${{ secrets.DEPENDENCY_TRACK_URL }}
DEPENDENCY_TRACK_API_KEY: ${{ secrets.DEPENDENCY_TRACK_API_KEY }}