@@ -17,19 +17,26 @@ jobs:
1717 version : ${{ steps.dotnet-pack.outputs.version }}
1818 nupkg-filename : ${{ steps.dotnet-pack.outputs.nupkg-filename }}
1919 steps :
20- - uses : actions/checkout@v2
20+ - name : Checkout git repository
21+ uses : actions/checkout@v2
2122 with :
2223 fetch-depth : 0
23- - uses : actions/cache@v2
24+ - name : Retrieve cached NuGet packages
25+ uses : actions/cache@v2
2426 with :
2527 path : ~/.nuget/packages
2628 key : ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
27- - run : dotnet restore --verbosity normal
28- - run : dotnet build --verbosity normal
29- - run : dotnet test --no-build --verbosity normal
30- - run : dotnet pack --output . --no-build --verbosity normal
29+ - name : Restore NuGet packages
30+ run : dotnet restore --verbosity normal
31+ - name : Build solution
32+ run : dotnet build --verbosity normal
33+ - name : Run tests
34+ run : dotnet test --no-build --verbosity normal
35+ - name : Create NuGet package
36+ run : dotnet pack --output . --no-build --verbosity normal
3137 id : dotnet-pack
32- - uses : actions/upload-artifact@v2
38+ - name : Upload NuGet package artifact
39+ uses : actions/upload-artifact@v2
3340 if : matrix.os == 'macos-latest'
3441 with :
3542 name : nuget-package
@@ -38,15 +45,19 @@ jobs:
3845 runs-on : macos-latest
3946 needs : package
4047 if : github.ref == 'refs/heads/prerelease' || startsWith(github.ref, 'refs/tags')
41- name : Publish NuGet package
48+ name : Publish NuGet package and create GitHub release
4249 steps :
43- - uses : actions/download-artifact@v2
50+ - name : Download NuGet package artifact
51+ uses : actions/download-artifact@v2
4452 with :
4553 name : nuget-package
46- - run : dotnet nuget push ${{ needs.package.outputs.nupkg-filename }} --source https://api.nuget.org/v3/index.json --api-key "${{ secrets.NUGET_API_KEY }}"
47- - run : dotnet nuget add source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --name github --username ${{ github.repository_owner }} --password ${{ github.token }} --store-password-in-clear-text
48- - run : dotnet nuget push ${{ needs.package.outputs.nupkg-filename }} --source github
49- - name : Create Release
54+ - name : Add GitHub package registry source
55+ run : dotnet nuget add source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --name github --username ${{ github.repository_owner }} --password ${{ github.token }} --store-password-in-clear-text
56+ - name : Publish NuGet package on nuget.org
57+ run : dotnet nuget push ${{ needs.package.outputs.nupkg-filename }} --source https://api.nuget.org/v3/index.json --api-key "${{ secrets.NUGET_API_KEY }}"
58+ - name : Publish NuGet package on github.com
59+ run : dotnet nuget push ${{ needs.package.outputs.nupkg-filename }} --source github
60+ - name : Create GitHub Release
5061 uses : actions/create-release@v1
5162 env :
5263 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments