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}