From 0d6c72254bb21d708a4d52afbbaa96b55c7f9904 Mon Sep 17 00:00:00 2001 From: Chase Redmon Date: Mon, 24 Nov 2025 17:04:09 -0500 Subject: [PATCH] Add NuGet release workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds GitHub Actions workflow to publish NuGet package when version tags are pushed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/release.yml | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..991a71f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Publish NuGet Package + +on: + push: + tags: + - 'v*' # e.g., v1.0.0, v1.2.3 + +jobs: + build: + runs-on: ubuntu-latest + + steps: + # 1. Checkout repository + - name: Checkout code + uses: actions/checkout@v4 + + # 2. Install .NET 10 SDK + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: '10.0.x' + + # 3. Extract version number from Git tag + - name: Extract version from tag + id: get_version + run: | + VERSION=${GITHUB_REF#refs/tags/v} + echo "PACKAGE_VERSION=$VERSION" >> $GITHUB_ENV + + # 4. Restore dependencies for the library + - name: Restore library dependencies + run: dotnet restore src/CatBox.NET/CatBox.NET.csproj + + # 5. Build the library + - name: Build library + run: dotnet build src/CatBox.NET/CatBox.NET.csproj --configuration Release --no-restore + + # 6. Run tests (pointing to your test project) + - name: Run tests + run: dotnet test tests/CatBox.Tests/CatBox.Tests.csproj --configuration Release --no-build + + # 7. Pack the NuGet package + - name: Pack NuGet package + run: dotnet pack src/CatBox.NET/CatBox.NET.csproj --configuration Release --no-build -o ./artifacts /p:PackageVersion=${{ env.PACKAGE_VERSION }} + + # 8. Publish package to nuget.org + - name: Publish NuGet package + run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json