Skip to content

Commit b35f1b4

Browse files
committed
chore: Add sbom generation and upload workflow
Adds stand-alone GitHub Action workflow to automatically generate and publish an aggregate SBOM for org.eclipse.jgit-parent, following a push of a release tag. The workflow can also be triggered manually (workflow_dispatch event) for testing, or to generate SBOMs for previous release tags. Change-Id: Ic9ab7d99a308ee74fd544dd1894d9b3de27c9676 Signed-off-by: Lukas Puehringer <lukas.puehringer@eclipse-foundation.org>
1 parent 07f5859 commit b35f1b4

2 files changed

Lines changed: 73 additions & 1 deletion

File tree

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Generate Maven SBOM
2+
3+
on:
4+
push:
5+
tags:
6+
- "v**" # Triggers when someone pushes a tag that starts with 'v'
7+
8+
workflow_dispatch:
9+
# The custom 'Version' input field allows running the workflow for older git
10+
# refs, where this workflow file did not exist yet. This would not be
11+
# possible with the builtin "Use workflow from" input field.
12+
inputs:
13+
version:
14+
description: "Version"
15+
default: "master"
16+
required: true
17+
18+
env:
19+
JAVA_VERSION: '17'
20+
JAVA_DISTRO: 'temurin'
21+
PLUGIN_VERSION: '2.9.1'
22+
SBOM_TYPE: 'makeAggregateBom'
23+
PROJECT_VERSION: "${{ github.event_name == 'release' && github.event.release.tag_name || github.event.inputs.version }}"
24+
25+
permissions:
26+
contents: read
27+
28+
jobs:
29+
generate-sbom:
30+
runs-on: ubuntu-latest
31+
outputs:
32+
# Make env var available in re-usuable workflow (see actions/runner#2372)
33+
project-version: ${{ env.PROJECT_VERSION }}
34+
steps:
35+
- name: Checkout repository at '${{ env.PROJECT_VERSION }}'
36+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
37+
with:
38+
fetch-depth: 0
39+
ref: ${{ env.PROJECT_VERSION }}
40+
persist-credentials: false
41+
42+
- name: Setup Java SDK
43+
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
44+
with:
45+
java-version: ${{ env.JAVA_VERSION }}
46+
distribution: ${{ env.JAVA_DISTRO }}
47+
48+
- name: Generate
49+
run: |
50+
mvn org.cyclonedx:cyclonedx-maven-plugin:${PLUGIN_VERSION}:${SBOM_TYPE} \
51+
-DoutputFormat=json \
52+
-DoutputDirectory=target \
53+
-DoutputName=cyclonedx
54+
55+
56+
- name: Upload
57+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
58+
with:
59+
name: sbom
60+
path: target/cyclonedx.json
61+
62+
# Store SBOM and metadata in a predefined format for otterdog to pick up
63+
store-sbom-data:
64+
needs: ['generate-sbom']
65+
uses: eclipse-csi/workflows/.github/workflows/store-sbom-data.yml@main
66+
with:
67+
projectName: 'JGit'
68+
projectVersion: ${{ needs.generate-sbom.outputs.project-version }}
69+
bomArtifact: 'sbom'
70+
bomFilename: 'cyclonedx.json'
71+
parentProject: '6638fa7e-8518-4528-9419-e24f629b7e9f'
72+

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@
609609
<artifactId>cyclonedx-maven-plugin</artifactId>
610610
<configuration>
611611
<projectType>library</projectType>
612-
<schemaVersion>1.4</schemaVersion>
612+
<schemaVersion>1.6</schemaVersion>
613613
<includeBomSerialNumber>true</includeBomSerialNumber>
614614
<includeCompileScope>true</includeCompileScope>
615615
<includeProvidedScope>true</includeProvidedScope>

0 commit comments

Comments
 (0)