Skip to content

Commit 82c05ca

Browse files
committed
Add CycloneDX BOM generation and upload to Dependency-Track
1 parent 74be1cc commit 82c05ca

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

.github/workflows/publish.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,22 @@ jobs:
2929
env:
3030
ONELITEFEATHER_MAVEN_USERNAME: ${{ secrets.ONELITEFEATHER_MAVEN_USERNAME }}
3131
ONELITEFEATHER_MAVEN_PASSWORD: ${{ secrets.ONELITEFEATHER_MAVEN_PASSWORD }}
32+
- name: Generate CycloneDX BOM
33+
run: ./gradlew cyclonedxBom
34+
- name: Strip leading v from tag
35+
if: startsWith(github.ref, 'refs/tags/')
36+
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
37+
- run: |
38+
echo "Version: $VERSION"
39+
name: Display Version
40+
- name: Upload BOM to Dependency-Track
41+
uses: DependencyTrack/gh-upload-sbom@v3
42+
with:
43+
serverhostname: ${{ secrets.DEPENDENCYTRACK_HOSTNAME }}
44+
apikey: ${{ secrets.DEPENDENCYTRACK_APIKEY }}
45+
projectname: "Mycelium-Bom"
46+
projectversion: ${{ env.VERSION }}
47+
projecttags: 'bom,minestom'
48+
bomfilename: "build/reports/cyclonedx/bom.xml"
49+
autocreate: true
50+
parent: '9a10b066-ecf1-4b38-b670-a197dcd5556a'

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
`maven-publish`
33
`java-platform`
4+
alias(libs.plugins.cyclonedx)
45
}
56

67
group = "net.onelitefeather"

settings.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ dependencyResolutionManagement {
2626
version("junit.bom", "6.0.1")
2727
version("mockito", "5.20.0")
2828
version("cyano", "0.4.1")
29+
version("cyclonedx", "3.0.1")
2930

3031
library("minestom","net.minestom", "minestom").versionRef("minestom")
3132
library("cyano", "net.onelitefeather", "cyano").versionRef("cyano")
@@ -37,6 +38,8 @@ dependencyResolutionManagement {
3738
// Mock libraries
3839
library("mockito-core", "org.mockito", "mockito-core").versionRef("mockito")
3940
library("mockito-junit-jupiter", "org.mockito", "mockito-junit-jupiter").versionRef("mockito")
41+
42+
plugin("cyclonedx", "org.cyclonedx.bom").versionRef("cyclonedx")
4043
}
4144
}
4245
}

0 commit comments

Comments
 (0)