Skip to content

Publish NuGet Package #27

Publish NuGet Package

Publish NuGet Package #27

Workflow file for this run

name: Publish NuGet Package on Tag
on:
push:
tags:
- 'v*.*.*'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Extract tag version
id: tag_version
run: |
TAG=${GITHUB_REF#refs/tags/}
echo "TAG_VERSION=${TAG#v}" >> $GITHUB_OUTPUT
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Pack
run: dotnet pack --configuration Release --no-build -o out \
-p:PackageVersion=${{ steps.tag_version.outputs.TAG_VERSION }}
- name: Push to NuGet
run: dotnet nuget push out/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json