Skip to content

Publish package

Publish package #3

Workflow file for this run

name: Publish package
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
nuget-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Verify commit exists in origin/main
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
git branch --remote --contains | grep origin/main
- name: Set VERSION variable from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- uses: actions/setup-dotnet@v3
with:
dotnet-version: "8.0.x"
cache: true
cache-dependency-path: src/**/packages.lock.json
- run: dotnet restore --locked-mode
- run: dotnet pack --no-restore --include-symbols -o . /p:Version=${VERSION}
- name: Deploy to NuGet
run: dotnet nuget push *.nupkg --api-key $NUGET_AUTH_TOKEN --source https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }}
- name: Deploy to GitHub Package Registry
run: dotnet nuget push *.nupkg --api-key $NUGET_AUTH_TOKEN --source https://nuget.pkg.github.com/anexia/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}