1+ name : Publish NuGet packages
2+ on :
3+ workflow_dispatch :
4+ inputs :
5+ version :
6+ description : ' Version'
7+ required : true
8+ default : ' 0.1.0-rc.1'
9+ release :
10+ types : [published]
11+ jobs :
12+ verify :
13+ name : Verify App
14+ runs-on : ubuntu-latest
15+ steps :
16+ - uses : actions/checkout@v2
17+ - name : Run Unit Tests
18+ run : dotnet test src/Promitor.Parsers.Prometheus.Tests/Promitor.Parsers.Prometheus.Tests.csproj
19+ push_nuget_to_ghpr :
20+ name : Push NuGet package to NuGet.org
21+ runs-on : ubuntu-latest
22+ needs : [verify]
23+ steps :
24+ - uses : actions/checkout@v2
25+ - name : Set version for release trigger
26+ uses :
allenevans/[email protected] 27+ if : ${{ github.event_name == 'release' }}
28+ with :
29+ NUGET_VERSION : ${{ github.event.release.tag_name }}
30+ - name : Set version for workflow dispatch
31+ uses :
allenevans/[email protected] 32+ if : ${{ github.event_name == 'workflow_dispatch' }}
33+ with :
34+ NUGET_VERSION : ${{ github.event.inputs.version }}
35+ # Set NuGet package name since env.NUGET_PACKAGE_NAME doesn't resolve the variables
36+ - name : Set NuGet package name
37+ uses :
allenevans/[email protected] 38+ with :
39+ NUGET_PACKAGE_NAME : Promitor.Parsers.Prometheus.Core.${{ env.NUGET_VERSION }}.nupkg
40+ # Set NuGet package name since env.NUGET_PACKAGE_PATH doesn't resolve the variables
41+ - name : Set NuGet package path
42+ uses :
allenevans/[email protected] 43+ with :
44+ NUGET_PACKAGE_PATH : ./src/Promitor.Parsers.Prometheus.Core/bin/Release/${{ env.NUGET_PACKAGE_NAME }}
45+ - name : Build Solution
46+ run : dotnet build ./src/Promitor.Parsers.Prometheus.Core.csproj --configuration Release -p:Version=${{ env.NUGET_VERSION }}
47+ - name : Push NuGet package
48+ run : dotnet nuget push "${{ env.NUGET_PACKAGE_PATH }}" --api-key ${{ secrets.NUGET_REGISTRY_NUGETORG_APIKEY }} --source https://api.nuget.org/v3/index.json
49+ - name : Upload NuGet Package
50+ uses : actions/upload-artifact@v2
51+ with :
52+ name : ${{ env.NUGET_PACKAGE_NAME }}
53+ path : ${{ env.NUGET_PACKAGE_PATH }}
0 commit comments