Add workflows/publish-nugets.yaml

This commit is contained in:
Mathias Beaulieu-Duncan 2024-11-11 11:43:53 -05:00
parent 2d401dd67c
commit f0e4b0425c

View File

@ -0,0 +1,38 @@
name: Publish NuGets
on:
release:
published:
- tag
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Extract Release Version
shell: bash
run: echo "RELEASE_VERSION=${GITEA_TAG_NAME}" >> $GITEA_ENV
- name: Debug Release Version
run: echo "RELEASE_VERSION=${RELEASE_VERSION}"
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x
- name: Restore dependencies
run: dotnet restore
- name: Build and Pack NuGet Package
run: dotnet pack -c Release -o ./artifacts -p:Version=${RELEASE_VERSION}
- name: Publish to NuGet.org
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
dotnet nuget push ./artifacts/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_API_KEY}