Skip to content

Bump actions/checkout from 3.6.0 to 4.0.0 (#380) #126

Bump actions/checkout from 3.6.0 to 4.0.0 (#380)

Bump actions/checkout from 3.6.0 to 4.0.0 (#380) #126

Workflow file for this run

name: build
on:
push:
branches: [ main ]
tags: [ v* ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
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@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Setup .NET SDK
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0
- name: Build, Test and Publish
shell: pwsh
run: ./build.ps1
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1
NUGET_XMLDOC_MODE: skip
TERM: xterm
- name: Publish artifacts
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: artifacts-${{ matrix.os_name }}
path: ./artifacts/packages
- name: Publish NuGet packages
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: packages-${{ matrix.os_name }}
path: ./artifacts/packages
if-no-files-found: error
validate-packages:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download packages
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: packages-linux
- name: Setup .NET SDK
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0
- 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: 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@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: packages-linux
- name: Setup .NET SDK
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0
- 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: 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@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: packages-linux
- name: Setup .NET SDK
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0
- 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