File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,15 +24,15 @@ jobs:
2424 - name : Restore
2525 run : dotnet restore BlockingCollectionExtensions.sln
2626
27+ - name : Test
28+ run : dotnet test BlockingCollectionExtensions.sln --configuration Release --no-restore
29+
2730 - name : Build net8.0
2831 run : dotnet build BlockingCollectionExtensions/BlockingCollectionExtensions.csproj --configuration Release --framework net8.0 --no-restore
2932
3033 - name : Build netstandard2.1
3134 run : dotnet build BlockingCollectionExtensions/BlockingCollectionExtensions.csproj --configuration Release --framework netstandard2.1 --no-restore
3235
33- - name : Pack
34- run : dotnet pack BlockingCollectionExtensions/BlockingCollectionExtensions.csproj --configuration Release --no-build -p:EnablePackageValidation=true -o artifacts
35-
3636 - name : Upload package artifacts
3737 uses : actions/upload-artifact@v4
3838 with :
Original file line number Diff line number Diff line change 11name : Release
22
33on :
4+ workflow_dispatch :
5+ inputs :
6+ publish_to_nuget :
7+ description : Publish packages to NuGet
8+ required : true
9+ default : false
10+ type : boolean
411 push :
512 tags :
6- - ' v*'
7- workflow_dispatch :
13+ - " v*.*.*"
814
915jobs :
10- publish :
16+ release :
1117 runs-on : ubuntu-latest
18+ permissions :
19+ contents : read
1220
1321 steps :
1422 - name : Checkout
@@ -28,16 +36,26 @@ jobs:
2836
2937 - name : Build netstandard2.1
3038 run : dotnet build BlockingCollectionExtensions/BlockingCollectionExtensions.csproj --configuration Release --framework netstandard2.1 --no-restore
39+
40+ - name : Test
41+ run : dotnet test BlockingCollectionExtensions.sln --configuration Release --no-restore
3142
3243 - name : Pack
3344 run : dotnet pack BlockingCollectionExtensions/BlockingCollectionExtensions.csproj --configuration Release --no-build -p:EnablePackageValidation=true -o artifacts
3445
35- - name : Publish packages to NuGet
36- if : startsWith(github.ref, 'refs/tags/v')
37- run : dotnet nuget push "./artifacts/*.nupkg" --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
38-
39- - name : Upload release artifacts
46+ - name : Upload package artifacts
4047 uses : actions/upload-artifact@v4
4148 with :
4249 name : release-packages
4350 path : artifacts/*
51+
52+ - name : Publish to NuGet
53+ if : startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_nuget
54+ env :
55+ NUGET_API_KEY : ${{ secrets.NUGET_API_KEY }}
56+ run : |
57+ test -n "$NUGET_API_KEY"
58+ dotnet nuget push "artifacts/*.nupkg" \
59+ --api-key "$NUGET_API_KEY" \
60+ --source https://api.nuget.org/v3/index.json \
61+ --skip-duplicate
You can’t perform that action at this time.
0 commit comments