-
Notifications
You must be signed in to change notification settings - Fork 2
56 lines (52 loc) · 1.65 KB
/
reusable_sbom.yaml
File metadata and controls
56 lines (52 loc) · 1.65 KB
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
name: 'Reusable: Send SBOM to a dependency tracker'
# This is a reusable build step, that is supposed to handle the generic task of
# sending a SBOM somewhere.
# This action should be as generic as possible. Maybe extract it to a repo
#
# TODO: Could be made more customizable with: `jq`, `fromJSON`, `toJSON` and `join`
on:
workflow_call:
inputs:
dependency_tracker_url:
description: 'Url to send SBOM to'
type: string
required: true
project:
description: 'Project name'
type: string
required: false
project_version:
description: 'Project version'
type: string
required: false
secrets:
DEPENDENCY_TRACKER_TOKEN:
description: 'Token for the dependency tracker'
required: true
jobs:
sbom:
environment: deploy
runs-on: 'ubuntu-latest'
steps:
- uses: anchore/sbom-action@0
format: cyclonedx
output-file: sbom.xml
- name: 'Push SBOM to dependency tracker'
env:
URL: ${{ inputs.dependency_tracker_url }}
PROJECT: ${{ inputs.project }}
VERSION: ${{ inputs.project_version }}
TOKEN: ${{ secrets.DEPENDENCY_TRACKER_TOKEN }}
run: |
curl \
--silent \
--verbose \
--location \
--request POST \
--header "X-Api-Key: ${TOKEN}" \
--header "Content-Type: multipart/form-data" \
--form "autoCreate=true" \
--form "projectName=${PROJECT:-$GITHUB_REPOSITORY}" \
--form "projectVersion=${VERSION:-latest}" \
--form "bom=@sbom.xml" \
"${URL}"