From 634b795f18a6de0eae0bada6b7a3cf32348fbb8c Mon Sep 17 00:00:00 2001 From: David Eriksson Date: Thu, 26 Feb 2026 12:56:23 +0100 Subject: [PATCH 1/5] Create nugets via GitHub actions --- .github/workflows/dotnet.yml | 35 +++++++++++++ .github/workflows/release.yml | 94 +++++++++++++++++++++++++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 129c228..513279d 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -30,6 +30,41 @@ jobs: - name: Test timeout-minutes: 2 run: dotnet test --no-build + - name: Pack NuGet packages (PR validation) + if: matrix.dotnet-version == '8.0.x' + run: | + dotnet pack Activout.RestClient/Activout.RestClient.csproj \ + -p:PackageVersion=1.0.0-pr${{ github.event.pull_request.number }}.${{ github.run_number }} \ + --configuration=Release \ + --no-build \ + --include-symbols \ + --include-source + dotnet pack Activout.RestClient.Json/Activout.RestClient.Json.csproj \ + -p:PackageVersion=1.0.0-pr${{ github.event.pull_request.number }}.${{ github.run_number }} \ + --configuration=Release \ + --no-build \ + --include-symbols \ + --include-source + dotnet pack Activout.RestClient.Newtonsoft.Json/Activout.RestClient.Newtonsoft.Json.csproj \ + -p:PackageVersion=1.0.0-pr${{ github.event.pull_request.number }}.${{ github.run_number }} \ + --configuration=Release \ + --no-build \ + --include-symbols \ + --include-source + dotnet pack Activout.RestClient.Xml/Activout.RestClient.Xml.csproj \ + -p:PackageVersion=1.0.0-pr${{ github.event.pull_request.number }}.${{ github.run_number }} \ + --configuration=Release \ + --no-build \ + --include-symbols \ + --include-source + - name: Upload NuGet packages + if: matrix.dotnet-version == '8.0.x' + uses: actions/upload-artifact@v4 + with: + name: nuget-packages-pr${{ github.event.pull_request.number }}-run${{ github.run_number }} + path: | + **/*.nupkg + **/*.snupkg # - name: Archive test results # uses: actions/upload-artifact@v4 # if: always() diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c5997e1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,94 @@ +name: Release + +on: + release: + types: [created] + +jobs: + build-and-publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Extract version from tag + id: get_version + run: | + # Remove 'v' prefix if present (e.g., v1.2.3 -> 1.2.3) + VERSION=${GITHUB_REF#refs/tags/} + VERSION=${VERSION#v} + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT + echo "Building version: $VERSION" + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --configuration=Release --no-restore + + - name: Test + timeout-minutes: 2 + run: dotnet test --configuration=Release --no-build + + - name: Pack Activout.RestClient + run: | + dotnet pack Activout.RestClient/Activout.RestClient.csproj \ + -p:PackageVersion=${{ steps.get_version.outputs.VERSION }} \ + --configuration=Release \ + --no-build \ + --include-symbols \ + --include-source \ + --output ./nupkgs + + - name: Pack Activout.RestClient.Json + run: | + dotnet pack Activout.RestClient.Json/Activout.RestClient.Json.csproj \ + -p:PackageVersion=${{ steps.get_version.outputs.VERSION }} \ + --configuration=Release \ + --no-build \ + --include-symbols \ + --include-source \ + --output ./nupkgs + + - name: Pack Activout.RestClient.Newtonsoft.Json + run: | + dotnet pack Activout.RestClient.Newtonsoft.Json/Activout.RestClient.Newtonsoft.Json.csproj \ + -p:PackageVersion=${{ steps.get_version.outputs.VERSION }} \ + --configuration=Release \ + --no-build \ + --include-symbols \ + --include-source \ + --output ./nupkgs + + - name: Pack Activout.RestClient.Xml + run: | + dotnet pack Activout.RestClient.Xml/Activout.RestClient.Xml.csproj \ + -p:PackageVersion=${{ steps.get_version.outputs.VERSION }} \ + --configuration=Release \ + --no-build \ + --include-symbols \ + --include-source \ + --output ./nupkgs + + - name: List generated packages + run: ls -lh ./nupkgs/ + + - name: Upload packages to release + uses: softprops/action-gh-release@v2 + with: + files: ./nupkgs/*.nupkg + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # Uncomment to publish to NuGet.org + # - name: Push to NuGet.org + # run: | + # dotnet nuget push ./nupkgs/*.nupkg \ + # --api-key ${{ secrets.NUGET_API_KEY }} \ + # --source https://api.nuget.org/v3/index.json \ + # --skip-duplicate From 379a89b7481a93daeb9074bdfc2d5d895ad0e024 Mon Sep 17 00:00:00 2001 From: David Eriksson Date: Thu, 26 Feb 2026 12:59:44 +0100 Subject: [PATCH 2/5] Ser permissions --- .github/workflows/dotnet.yml | 3 +++ .github/workflows/release.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 513279d..78e62c0 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -4,6 +4,9 @@ on: pull_request: branches: [ main ] +permissions: + contents: read + jobs: build: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c5997e1..6f1cef8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,9 @@ on: release: types: [created] +permissions: + contents: write + jobs: build-and-publish: runs-on: ubuntu-latest From 21f2106dcf15edc393503b6301eef6ef9d822890 Mon Sep 17 00:00:00 2001 From: David Eriksson Date: Thu, 26 Feb 2026 13:04:02 +0100 Subject: [PATCH 3/5] Release build --- .github/workflows/dotnet.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 78e62c0..1e819cf 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -29,10 +29,10 @@ jobs: - name: Restore dependencies run: dotnet restore - name: Build - run: dotnet build --no-restore + run: dotnet build --configuration=Release --no-restore - name: Test timeout-minutes: 2 - run: dotnet test --no-build + run: dotnet test --configuration=Release --no-build - name: Pack NuGet packages (PR validation) if: matrix.dotnet-version == '8.0.x' run: | From b638af1c664565533848c6f31adaa3f242ead5bd Mon Sep 17 00:00:00 2001 From: David Eriksson Date: Thu, 26 Feb 2026 13:18:05 +0100 Subject: [PATCH 4/5] Publish to nuget.org on release --- .github/workflows/release.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6f1cef8..6b8c5a7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -88,10 +88,9 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Uncomment to publish to NuGet.org - # - name: Push to NuGet.org - # run: | - # dotnet nuget push ./nupkgs/*.nupkg \ - # --api-key ${{ secrets.NUGET_API_KEY }} \ - # --source https://api.nuget.org/v3/index.json \ - # --skip-duplicate + - name: Push to NuGet.org + run: | + dotnet nuget push ./nupkgs/*.nupkg \ + --api-key ${{ secrets.NUGET_API_KEY }} \ + --source https://api.nuget.org/v3/index.json \ + --skip-duplicate From 232009c2b135403d1786d8aff7db9ef103afc774 Mon Sep 17 00:00:00 2001 From: David Eriksson Date: Thu, 26 Feb 2026 13:28:10 +0100 Subject: [PATCH 5/5] Only save and push *.symbols.nupkg --- .github/workflows/dotnet.yml | 3 +-- .github/workflows/release.yml | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 1e819cf..e3acf1e 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -66,8 +66,7 @@ jobs: with: name: nuget-packages-pr${{ github.event.pull_request.number }}-run${{ github.run_number }} path: | - **/*.nupkg - **/*.snupkg + **/*.symbols.nupkg # - name: Archive test results # uses: actions/upload-artifact@v4 # if: always() diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b8c5a7..a5011a4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -84,13 +84,13 @@ jobs: - name: Upload packages to release uses: softprops/action-gh-release@v2 with: - files: ./nupkgs/*.nupkg + files: ./nupkgs/*.symbols.nupkg env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Push to NuGet.org run: | - dotnet nuget push ./nupkgs/*.nupkg \ + dotnet nuget push ./nupkgs/*.symbols.nupkg \ --api-key ${{ secrets.NUGET_API_KEY }} \ --source https://api.nuget.org/v3/index.json \ --skip-duplicate