fix workflow dispatch #23
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: .NET Core | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Package Version" | |
required: true | |
default: "3.1.0.6-alpha" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
dotnet-version: ["2.2.108", "8.0.x"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 2.2.108 | |
- name: Build with dotnet | |
run: dotnet build --configuration Release | |
- name: Test | |
run: dotnet test src/PostalCodes.UnitTests/PostalCodes.UnitTests.csproj | |
publish: | |
needs: build | |
if: github.event_name == 'workflow_dispatch' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Publish | |
run: | | |
dotnet pack . -p:PackageVersion=${{ github.event.inputs.version }} -o . | |
dotnet nuget push src/PostalCodes/PostalCodes.${{ github.event.inputs.version }}.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json | |
dotnet nuget push src/PostalCodes/PostalCodes.${{ github.event.inputs.version }}.snupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json |