Skip to content

Commit 73ec39b

Browse files
authored
Enhance workflow to include SBOM generation and upload
Added steps to generate and upload SBOM using CycloneDX.
1 parent d9a169c commit 73ec39b

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

.github/workflows/Build-Release.yml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# This workflow will build, test, sign and pack the release branches for EPPlus.
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3-
41
name: Build Release Branches
52

63
on:
@@ -21,6 +18,20 @@ jobs:
2118
dotnet-version: '9.0.x'
2219
- name: Restore dependencies
2320
run: dotnet restore ./src/EPPlus.sln
21+
22+
# --- SBOM ---
23+
- name: Install CycloneDX
24+
run: dotnet tool install --global CycloneDX
25+
- name: Read version from csproj
26+
id: read_version
27+
run: |
28+
$version = ([xml](Get-Content ./src/EPPlus/EPPlus.csproj)).Project.PropertyGroup.Version | Where-Object { $_ } | Select-Object -First 1
29+
echo "VERSION=$version" >> $env:GITHUB_ENV
30+
shell: pwsh
31+
- name: Generate SBOM
32+
run: dotnet CycloneDX ./src/EPPlus/EPPlus.csproj -o ./sbom -F Json -st Library -sv ${{ env.VERSION }} -fn epplus-${{ env.VERSION }}.sbom.json -imp ./src/EPPlus/sbom-metadata-template.xml
33+
# --- SBOM ---
34+
2435
- name: Build
2536
run: dotnet build ./src/EPPlus.sln --no-restore --configuration Release
2637
- name: Test
@@ -70,3 +81,21 @@ jobs:
7081
with:
7182
name: signed-nuget-package
7283
path: ./output/*.nupkg
84+
# --- SBOM ---
85+
- name: Upload SBOM to Azure Blob Storage
86+
run: |
87+
az storage blob upload `
88+
--account-name eppluswebprod `
89+
--container-name sbom `
90+
--name epplus-${{ env.VERSION }}.sbom.json `
91+
--file ./sbom/epplus-${{ env.VERSION }}.sbom.json `
92+
--auth-mode login `
93+
--overwrite
94+
shell: pwsh
95+
96+
- name: Upload SBOM as artifact
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: sbom
100+
path: ./sbom/epplus-${{ env.VERSION }}.sbom.json
101+
# --- SBOM ---

0 commit comments

Comments
 (0)