From fa626d53b2485dc8a555aeb7dc9680773ed09b0f Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Fri, 20 Feb 2026 13:29:27 -0500 Subject: [PATCH] Add Gitea workflow to pack and publish NuGet packages on push --- .gitea/workflows/nuget.yml | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .gitea/workflows/nuget.yml diff --git a/.gitea/workflows/nuget.yml b/.gitea/workflows/nuget.yml new file mode 100644 index 0000000..73ef44c --- /dev/null +++ b/.gitea/workflows/nuget.yml @@ -0,0 +1,50 @@ +name: NuGet Package Publish + +on: + push: + +jobs: + nuget: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 10.0.x + + - name: Restore + run: dotnet restore CBDDC.Libs.slnx + + - name: Pack + run: dotnet pack CBDDC.Libs.slnx --configuration Release --no-restore --output artifacts/nuget + + - name: Publish to Gitea NuGet + shell: bash + env: + NUGET_SOURCE_URL: ${{ github.server_url }}/api/packages/${{ github.repository_owner }}/nuget/index.json + NUGET_USERNAME: ${{ secrets.NUGET_USERNAME || github.actor }} + NUGET_TOKEN: ${{ secrets.NUGET_TOKEN || secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + + if [ -z "${NUGET_TOKEN:-}" ]; then + echo "NUGET_TOKEN and GITHUB_TOKEN are both unavailable." + echo "Configure one of: secrets.NUGET_TOKEN (preferred) or secrets.GITHUB_TOKEN." + exit 1 + fi + + dotnet nuget add source "$NUGET_SOURCE_URL" \ + --name gitea \ + --username "$NUGET_USERNAME" \ + --password "$NUGET_TOKEN" \ + --store-password-in-clear-text + + find artifacts/nuget -name '*.nupkg' ! -name '*.symbols.nupkg' -print0 | \ + xargs -0 -I{} dotnet nuget push "{}" \ + --source gitea \ + --api-key "$NUGET_TOKEN" \ + --skip-duplicate