Expand NuGet workflow triggers to include develop branch and add co…
#23
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: | |
| branches: [ master, develop ] | |
| tags: [ 'v*.*.*', 'v*.*', 'v*.*.*-alpha*', 'v*.*-alpha*' ] | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build Gml.Core.sln --configuration Release | |
| - name: Test | |
| run: dotnet test Gml.Core.sln --configuration Release --no-build --verbosity normal | |
| publish: | |
| needs: validate | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| env: | |
| NUGET_IGNORE_FAILED_SOURCES: 'true' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| source-url: https://api.nuget.org/v3/index.json | |
| env: | |
| NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }} | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build and pack interfaces | |
| run: | | |
| dotnet build src/Gml.Interfaces/Gml.Interfaces.csproj --configuration Release | |
| dotnet pack src/Gml.Interfaces/Gml.Interfaces.csproj --configuration Release --no-build --output ./nupkgs | |
| - name: Build and pack domains | |
| run: | | |
| dotnet build src/Gml.Domains/Gml.Domains.csproj --configuration Release | |
| dotnet pack src/Gml.Domains/Gml.Domains.csproj --configuration Release --no-build --output ./nupkgs | |
| - name: Build and pack dto | |
| run: | | |
| dotnet build src/Gml.Dto/Gml.Dto.csproj --configuration Release | |
| dotnet pack src/Gml.Dto/Gml.Dto.csproj --configuration Release --no-build --output ./nupkgs | |
| - name: Add local NuGet source | |
| run: dotnet nuget add source "./nupkgs" --name LocalPackages | |
| - name: Build full solution | |
| run: dotnet build Gml.Core.sln --configuration Release | |
| - name: Publish 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 |