Remove WithOptions pattern #11
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 build instance | |
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 | |
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 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
dotnet-quality: 'ga' | |
- name: Publish packages to GitHub | |
if: github.event.inputs.packregistry == 'GitHub' | |
run: | | |
./build publish --NuGetSource https://nuget.pkg.github.com/cecilphillip-stripe/index.json --NuGetApiKey ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish packages to NuGet | |
if: github.event.inputs.packregistry == 'NuGet' | |
run: | | |
./build publish --NuGetSource https://api.nuget.org/v3/index.json --NuGetApiKey ${{ secrets.NUGET_API_KEY }} |