Skip to content

Commit

Permalink
DST-633: setup dependency track
Browse files Browse the repository at this point in the history
  • Loading branch information
aromko committed Dec 23, 2024
1 parent 37c1225 commit 3161daa
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/dependency-track.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Generate and Upload SBOM to Dependency-Track

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
generate-and-upload-sbom:
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the code
- name: Checkout Code
uses: actions/checkout@v3

# Step 2: Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20' # Use the desired Node.js version

# Step 3: Install cdxgen
- name: Install cdxgen
run: |
npm install -g @cyclonedx/cdxgen
# Step 4: Generate SBOM
- name: Generate SBOM
run: |
cdxgen -o sbom.json
# Step 4: Upload SBOM to Dependency-Track
- name: Upload SBOM to Dependency-Track
env:
DEPENDENCY_TRACK_API_KEY: ${{ secrets.DEPENDENCY_TRACK_API_KEY }}
DEPENDENCY_TRACK_SERVER: ${{ secrets.DEPENDENCY_TRACK_SERVER }}
DEPENDENCY_TRACK_PROJECT_NAME: ${{ secrets.DEPENDENCY_TRACK_PROJECT_NAME }}
DEPENDENCY_TRACK_PARENT_PROJECT: ${{ secrets.DEPENDENCY_TRACK_PARENT_PROJECT }}
DEPENDENCY_TRACK_PROJECT_VERSION: ${{ secrets.DEPENDENCY_TRACK_PROJECT_VERSION }}
DEPENDENCY_TRACK_FILE: ${{ secrets.DEPENDENCY_TRACK_FILE }}
run: |
curl -X POST \
-H "Content-Type: multipart/form-data" \
-H "X-API-Key: $DEPENDENCY_TRACK_API_KEY" \
-F "autoCreate=true" \
-F "projectName=$DEPENDENCY_TRACK_PROJECT_NAME" \
-F "parentName=$DEPENDENCY_TRACK_PARENT_PROJECT" \
-F "projectVersion=$DEPENDENCY_TRACK_PROJECT_VERSION" \
-F "bom=@$DEPENDENCY_TRACK_FILE" \
"$DEPENDENCY_TRACK_SERVER/api/v1/bom"

0 comments on commit 3161daa

Please sign in to comment.