@@ -17,19 +17,26 @@ jobs:
17
17
version : ${{ steps.dotnet-pack.outputs.version }}
18
18
nupkg-filename : ${{ steps.dotnet-pack.outputs.nupkg-filename }}
19
19
steps :
20
- - uses : actions/checkout@v2
20
+ - name : Checkout git repository
21
+ uses : actions/checkout@v2
21
22
with :
22
23
fetch-depth : 0
23
- - uses : actions/cache@v2
24
+ - name : Retrieve cached NuGet packages
25
+ uses : actions/cache@v2
24
26
with :
25
27
path : ~/.nuget/packages
26
28
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
31
37
id : dotnet-pack
32
- - uses : actions/upload-artifact@v2
38
+ - name : Upload NuGet package artifact
39
+ uses : actions/upload-artifact@v2
33
40
if : matrix.os == 'macos-latest'
34
41
with :
35
42
name : nuget-package
@@ -38,15 +45,19 @@ jobs:
38
45
runs-on : macos-latest
39
46
needs : package
40
47
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
42
49
steps :
43
- - uses : actions/download-artifact@v2
50
+ - name : Download NuGet package artifact
51
+ uses : actions/download-artifact@v2
44
52
with :
45
53
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
50
61
uses : actions/create-release@v1
51
62
env :
52
63
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments