Bump anchore/sbom-action from 0.17.4 to 0.17.5 #402
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: [ main ] | |
tags: [ v* ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
build: | |
name: ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
outputs: | |
dotnet-sdk-version: ${{ steps.setup-dotnet.outputs.dotnet-version }} | |
permissions: | |
attestations: write | |
contents: write | |
id-token: write | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ macos-latest, ubuntu-latest, windows-latest ] | |
include: | |
- os: macos-latest | |
os-name: macos | |
- os: ubuntu-latest | |
os-name: linux | |
- os: windows-latest | |
os-name: windows | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1 | |
id: setup-dotnet | |
- name: Build, Test and Publish | |
shell: pwsh | |
run: ./build.ps1 | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
DOTNET_NOLOGO: true | |
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1 | |
NUGET_XMLDOC_MODE: skip | |
TERM: xterm | |
- name: Generate SBOM | |
uses: anchore/sbom-action@1ca97d9028b51809cf6d3c934c3e160716e1b605 # v0.17.5 | |
with: | |
artifact-name: build-${{ matrix.os-name }}.spdx.json | |
output-file: ./artifacts/build.spdx.json | |
path: ./artifacts/bin | |
upload-release-assets: ${{ runner.os == 'Windows' }} | |
- name: Attest artifacts | |
uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 | |
if: | | |
runner.os == 'Windows' && | |
github.event.repository.fork == false && | |
(github.ref_name == github.event.repository.default_branch || startsWith(github.ref, 'refs/tags/v')) | |
with: | |
subject-path: | | |
./artifacts/publish/Quartermaster/release*/Quartermaster.dll | |
./artifacts/publish/Quartermaster/release*/Quartermaster.exe | |
./artifacts/publish/Quartermaster/release*/Watchman*.dll | |
./artifacts/publish/Watchman/release*/Watchman.exe | |
./artifacts/publish/Watchman/release*/Watchman*.dll | |
./artifacts/package/release/* | |
- name: Publish artifacts | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: artifacts-${{ matrix.os-name }} | |
path: ./artifacts | |
- name: Publish NuGet packages | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: packages-${{ matrix.os-name }} | |
path: ./artifacts/package/release | |
if-no-files-found: error | |
validate-packages: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download packages | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: packages-linux | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1 | |
with: | |
dotnet-version: ${{ needs.build.outputs.dotnet-sdk-version }} | |
- name: Validate NuGet packages | |
shell: pwsh | |
run: | | |
dotnet tool install --global dotnet-validate --version 0.0.1-preview.304 | |
$packages = Get-ChildItem -Filter "*.nupkg" | ForEach-Object { $_.FullName } | |
$invalidPackages = 0 | |
foreach ($package in $packages) { | |
dotnet validate package local $package | |
if ($LASTEXITCODE -ne 0) { | |
$invalidPackages++ | |
} | |
} | |
if ($invalidPackages -gt 0) { | |
Write-Output "::error::$invalidPackages NuGet package(s) failed validation." | |
exit 1 | |
} | |
publish-github: | |
needs: [ build, validate-packages ] | |
permissions: | |
packages: write | |
runs-on: ubuntu-latest | |
if: | | |
github.event.repository.fork == false && | |
(github.ref_name == github.event.repository.default_branch || | |
startsWith(github.ref, 'refs/tags/v')) | |
steps: | |
- name: Download packages | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: packages-linux | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1 | |
with: | |
dotnet-version: ${{ needs.build.outputs.dotnet-sdk-version }} | |
- name: Publish NuGet packages to GitHub Packages | |
run: dotnet nuget push "*.nupkg" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate --no-symbols --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json | |
publish-nuget: | |
needs: [ build, validate-packages ] | |
runs-on: ubuntu-latest | |
if: | | |
github.event.repository.fork == false && | |
startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Download packages | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: packages-linux | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1 | |
with: | |
dotnet-version: ${{ needs.build.outputs.dotnet-sdk-version }} | |
- name: Push NuGet packages to NuGet.org | |
run: dotnet nuget push "*.nupkg" --api-key ${{ secrets.NUGET_TOKEN }} --skip-duplicate --source https://api.nuget.org/v3/index.json |