|
1 | 1 | # This workflow will build, test, sign and pack the release branches for EPPlus. |
| 2 | +# It will also generate and publish an SBOM |
2 | 3 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net |
3 | 4 |
|
4 | 5 | name: Build Release Branches |
|
21 | 22 | dotnet-version: '9.0.x' |
22 | 23 | - name: Restore dependencies |
23 | 24 | run: dotnet restore ./src/EPPlus.sln |
| 25 | + |
| 26 | + # --- SBOM --- |
| 27 | + - name: Install CycloneDX |
| 28 | + run: dotnet tool install --global CycloneDX |
| 29 | + - name: Read version from csproj |
| 30 | + id: read_version |
| 31 | + run: | |
| 32 | + $version = ([xml](Get-Content ./src/EPPlus/EPPlus.csproj)).Project.PropertyGroup.Version | Where-Object { $_ } | Select-Object -First 1 |
| 33 | + echo "VERSION=$version" >> $env:GITHUB_ENV |
| 34 | + shell: pwsh |
| 35 | + - name: Generate SBOM |
| 36 | + 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 |
| 37 | + - name: Generate SHA-256 checksum for SBOM |
| 38 | + run: | |
| 39 | + $sbomFile = "./sbom/epplus-${{ env.VERSION }}.sbom.json" |
| 40 | + $hash = (Get-FileHash -Path $sbomFile -Algorithm SHA256).Hash.ToLower() |
| 41 | + "$hash epplus-${{ env.VERSION }}.sbom.json" | Out-File -FilePath "./sbom/epplus-${{ env.VERSION }}.sbom.json.sha256" -Encoding utf8NoBOM |
| 42 | + shell: pwsh |
| 43 | + # --- SBOM --- |
| 44 | + |
24 | 45 | - name: Build |
25 | 46 | run: dotnet build ./src/EPPlus.sln --no-restore --configuration Release |
26 | 47 | - name: Test |
|
70 | 91 | with: |
71 | 92 | name: signed-nuget-package |
72 | 93 | path: ./output/*.nupkg |
| 94 | + # --- SBOM --- |
| 95 | + - name: Upload SBOM to Azure Blob Storage |
| 96 | + run: | |
| 97 | + az storage blob upload ` |
| 98 | + --account-name eppluswebprod ` |
| 99 | + --container-name sbom ` |
| 100 | + --name epplus-${{ env.VERSION }}.sbom.json ` |
| 101 | + --file ./sbom/epplus-${{ env.VERSION }}.sbom.json ` |
| 102 | + --auth-mode login ` |
| 103 | + --overwrite |
| 104 | + shell: pwsh |
| 105 | + - name: Upload SBOM checksum to Azure Blob Storage |
| 106 | + run: | |
| 107 | + az storage blob upload ` |
| 108 | + --account-name eppluswebprod ` |
| 109 | + --container-name sbom ` |
| 110 | + --name epplus-${{ env.VERSION }}.sbom.json.sha256 ` |
| 111 | + --file ./sbom/epplus-${{ env.VERSION }}.sbom.json.sha256 ` |
| 112 | + --auth-mode login ` |
| 113 | + --overwrite |
| 114 | + shell: pwsh |
| 115 | + - name: Upload SBOM as artifact |
| 116 | + uses: actions/upload-artifact@v4 |
| 117 | + with: |
| 118 | + name: sbom |
| 119 | + path: | |
| 120 | + ./sbom/epplus-${{ env.VERSION }}.sbom.json |
| 121 | + ./sbom/epplus-${{ env.VERSION }}.sbom.json.sha256 |
| 122 | + # --- SBOM --- |
0 commit comments