Build and Publish Warden NuGet Package #4
Workflow file for this run
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 and Publish Warden NuGet Package | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build-and-publish: | |
runs-on: windows-2025 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4.3.0 | |
with: | |
dotnet-version: '9.0.x' | |
- name: Restore dependencies | |
run: dotnet restore Warden/Warden.csproj | |
- name: Build project | |
run: dotnet build Warden/Warden.csproj --configuration Release --no-restore | |
- name: Pack NuGet Package | |
run: dotnet pack Warden/Warden.csproj --configuration Release --no-build -o ./nupkg | |
- name: Publish NuGet Package | |
shell: pwsh | |
env: | |
NUGET_API_KEY: ${{ secrets.NUGET }} | |
run: | | |
$version = $env:GITHUB_REF -replace 'refs/tags/v', '' | |
Write-Host "Detected version: $version" | |
dotnet nuget push "./nupkg/Warden.NET.$version.nupkg" --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json |