Repository navigation
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: Build and Publish | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| pull_request: | |
| branches: [ "master" ] | |
| workflow_dispatch: | |
| jobs: | |
| build-and-publish: | |
| name: Build, Test and Publish | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 6.0.x | |
| 8.0.x | |
| - name: Restore dependencies | |
| run: dotnet restore CarbonAPI.Client.sln | |
| - name: Build | |
| run: dotnet build CarbonAPI.Client.sln --no-restore -c Release | |
| - name: Test | |
| run: dotnet test CarbonAPI.Client.sln --no-build -c Release --verbosity normal | |
| - name: Pack | |
| if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' | |
| run: dotnet pack Client/Client.csproj -c Release -o out --no-build --no-restore | |
| - name: NuGet login (OIDC → temp API key) | |
| uses: NuGet/login@v1 | |
| id: login | |
| with: | |
| user: carbon-bot | |
| - name: Push to NuGet | |
| if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' | |
| run: dotnet nuget push "out/*.nupkg" --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key ${{steps.login.outputs.NUGET_API_KEY}} |