Create dotnet-nuget.yml #1
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: Publish NuGet Package | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
configuration: [Release] | |
runs-on: windows-latest | |
env: | |
Solution_Name: Source\StaX.Domain.sln # Replace with your solution name, i.e. MyWpfApp.sln. | |
Wap_Project_Directory: Source\Packages # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package. | |
Wap_Project_Path: StaX.Domain\StaX.Domain.csproj # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj. | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Restore dependencies | |
run: dotnet restore $env:Solution_Name | |
- name: Build | |
run: dotnet build $env:Solution_Name --configuration Release --no-restore | |
- name: Test | |
run: dotnet test $env:Solution_Name --configuration Release --no-build --verbosity normal | |
- name: Pack | |
run: dotnet pack $env:Wap_Project_Path --configuration Release --no-build --output $env:Wap_Project_Directory | |
- name: Publish NuGet package | |
run: dotnet nuget push $env:Wap_Project_Directory/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json |