Update release yml to solution file #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| - name: Restore dependencies | |
| run: dotnet restore CatBox.NET.sln | |
| # 5. Build solution | |
| - name: Build solution | |
| run: dotnet build CatBox.NET.sln --configuration Release --no-restore | |
| # 6. Run tests | |
| - name: Run tests | |
| run: dotnet test CatBox.NET.sln --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 |