From f0e4b0425cf94ec7c9064fef7c3509dc3eb5f030 Mon Sep 17 00:00:00 2001 From: Mathias Beaulieu-Duncan Date: Mon, 11 Nov 2024 11:43:53 -0500 Subject: [PATCH] Add workflows/publish-nugets.yaml --- workflows/publish-nugets.yaml | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 workflows/publish-nugets.yaml diff --git a/workflows/publish-nugets.yaml b/workflows/publish-nugets.yaml new file mode 100644 index 0000000..32461e2 --- /dev/null +++ b/workflows/publish-nugets.yaml @@ -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}