build #4
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 | |
workflow_dispatch: | |
inputs: | |
packregistry: | |
description: 'Package registry to publish to' | |
type: choice | |
required: true | |
options: | |
- 'GitHub' | |
- 'NuGet' | |
defaults: | |
run: | |
shell: pwsh | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
DOTNET_GENERATE_ASPNET_CERTIFICATE: false | |
DOTNET_NOLOGO: true | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1 | |
# Only one instance of this build at a time. | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: build-${{matrix.os}} | |
strategy: | |
matrix: | |
os: [ windows-latest, ubuntu-latest, macOS-latest ] | |
dotnet-version: [ '6.0.x', '8.0.x' ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ matrix.dotnet-version }} | |
dotnet-quality: 'ga' | |
- name: Build | |
run: ./build compile | |
# - name: Test | |
# run: ./build test | |
package: | |
name: create-nuget-packages | |
runs-on: 'ubuntu-latest' | |
needs: [build] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
dotnet-quality: 'ga' | |
- name: Create Packages | |
run: ./build pack | |
- name: Upload packages to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: packages | |
path: | | |
artifacts/packages/*.nupkg | |
artifacts/packages/*.snupkg | |
publish: | |
name: publish-packages | |
runs-on: 'ubuntu-latest' | |
needs: [package] | |
if: github.event_name == 'workflow_dispatch' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup .NET for GitHub Packages | |
uses: actions/setup-dotnet@v4 | |
if: github.event.inputs.packregistry == 'GitHub' | |
with: | |
dotnet-version: '8.0.x' | |
dotnet-quality: 'ga' | |
env: | |
NUGET_API_KEY: ${{ secrets.GITHUB_TOKEN }} | |
NUGET_SOURCE: https://nuget.pkg.github.com/cecilphillip-stripe/index.json | |
- name: Setup .NET for NuGet | |
uses: actions/setup-dotnet@v4 | |
if: github.event.inputs.packregistry == 'NuGet' | |
with: | |
dotnet-version: '8.0.x' | |
dotnet-quality: 'ga' | |
env: | |
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
NUGET_SOURCE: https://api.nuget.org/v3/index.json | |
- name: Publish Packages | |
run: | | |
./build publish | |