Skip to content

Commit e3261d1

Browse files
cyclonedx validate sbom
1 parent 0114836 commit e3261d1

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

.github/workflows/build_all.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ jobs:
7070
pnpm set //npm.pkg.github.com/:_authToken="$NODE_AUTH_TOKEN";
7171
pnpm nx build sbom;
7272
73+
# - name: Install CycloneDX CLI & Validate CycloneDX SBOMs
74+
7375
- name: Upload SBOM artifacts
7476
if: ${{ github.event_name == 'push' || github.event.inputs.SBOM == 'true' }}
7577
uses: actions/upload-artifact@v4

.github/workflows/packages_publishing.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ env:
2020
NX_SKIP_NX_CACHE: true
2121
FILTER: ${{ github.event_name == 'workflow_dispatch' && inputs.filter || '' }}
2222
SET_TIMESTAMP_VERSION: ${{ inputs.tag == 'daily' }}
23+
CYCLONEDX_CLI_VERSION: 0.32.0
2324

2425
jobs:
2526
build:
@@ -81,6 +82,32 @@ jobs:
8182
pnpm set "//npm.pkg.github.com/:_authToken" "$env:NODE_AUTH_TOKEN"
8283
pnpm nx build sbom;
8384
85+
- name: Install CycloneDX CLI
86+
shell: bash
87+
run: |
88+
# extract to sbom pnpm project / scripts? (./packages/sbom/project.json)
89+
tool_dir="$RUNNER_TEMP/cyclonedx-cli"
90+
mkdir -p "$tool_dir"
91+
curl -fsSL "https://github.com/CycloneDX/cyclonedx-cli/releases/download/v${{ env.CYCLONEDX_CLI_VERSION }}/cyclonedx-win-x64.exe" -o "$tool_dir/cyclonedx.exe"
92+
chmod +x "$tool_dir/cyclonedx.exe" || true
93+
echo "$tool_dir" >> "$GITHUB_PATH"
94+
95+
- name: Validate CycloneDX SBOMs
96+
shell: bash
97+
run: |
98+
shopt -s nullglob
99+
sbom_files=(packages/sbom/dist/*.sbom.json)
100+
101+
if [ ${#sbom_files[@]} -eq 0 ]; then
102+
echo "No SBOM files found in packages/sbom/dist"
103+
exit 1
104+
fi
105+
106+
for file in "${sbom_files[@]}"; do
107+
echo "Validating $file"
108+
cyclonedx validate --input-file "$file" --input-format json --fail-on-errors
109+
done
110+
84111
- name: Build artifacts package
85112
run: pnpm run make-artifacts-package
86113

0 commit comments

Comments
 (0)