Bump actions/attest-build-provenance from 1.1.1 to 1.1.2 (#1419) #1648
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, dotnet-vnext] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
packages: read | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
DOTNET_NOLOGO: true | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1 | |
NUGET_XMLDOC_MODE: skip | |
TERM: xterm | |
jobs: | |
build: | |
name: ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
outputs: | |
dotnet-sdk-version: ${{ steps.setup-dotnet.outputs.dotnet-version }} | |
permissions: | |
attestations: write | |
contents: read | |
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@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0 | |
id: setup-dotnet | |
- name: Setup NuGet cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props') }} | |
restore-keys: ${{ runner.os }}-nuget- | |
- name: Build, Test and Package | |
if: ${{ runner.os != 'linux' }} | |
shell: pwsh | |
run: ./build.ps1 | |
- name: Build, Test, IntegrationTest and Package | |
if: ${{ runner.os == 'linux' }} | |
shell: pwsh | |
run: ./build.ps1 -EnableIntegrationTests | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@6d798873df2b1b8e5846dba6fb86631229fbcb17 # v4.4.0 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
file: ./artifacts/coverage/coverage.cobertura.xml | |
flags: ${{ matrix.os_name }} | |
- name: Attest artifacts | |
uses: actions/attest-build-provenance@173725a1209d09b31f9d30a3890cf2757ebbff0d # v1.1.2 | |
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/bin/JustSaying/release*/JustSaying.dll | |
./artifacts/bin/JustSaying.Extensions.Aws/release*/JustSaying.Extensions.Aws.dll | |
./artifacts/bin/JustSaying.Extensions.DependencyInjection.Microsoft/release*/JustSaying.Extensions.DependencyInjection.Microsoft.dll | |
./artifacts/bin/JustSaying.Extensions.DependencyInjection.StructureMap/release*/JustSaying.Extensions.DependencyInjection.StructureMap.dll | |
./artifacts/bin/JustSaying.Models/release*/JustSaying.Models.dll | |
./artifacts/package/release/* | |
- name: Publish NuGet packages | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.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@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
name: packages-windows | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0 | |
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." | |
} | |
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@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
name: packages-windows | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0 | |
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@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
name: packages-windows | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0 | |
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 |