1818 DOTNET_CLI_TELEMETRY_OPTOUT : true
1919
2020jobs :
21+ info :
22+ runs-on : ubuntu-latest
23+ steps :
24+ - run : echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
25+ - run : echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
26+ - run : echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
27+
2128 build :
2229 name : Build and Test
2330 runs-on : ubuntu-latest
24-
2531 steps :
2632 # Checks out a copy of your repository on the ubuntu-latest machine
2733 - name : Checkout Code
28- uses : actions/checkout@v2
34+ uses : actions/checkout@v3
2935 with :
3036 fetch-depth : 0
3137
@@ -43,18 +49,32 @@ jobs:
4349 run : dotnet pack --configuration Release --no-restore --no-build --output publish
4450
4551 - name : Publish GitHub Artifact
46- uses : actions/upload-artifact@v2
52+ uses : actions/upload-artifact@v3
4753 with :
4854 name : nuget
4955 path : publish/*.nupkg
5056
51- # Publish NuGet packages
52- - name : Publish NuGet Package to nuget.org
53- if : github.event_name == 'pull_request' || startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/tags/')
54- env :
55- NUGET_APIKEY : ${{ secrets.NUGET_KEY_NULLFORCE_API }}
56- run : dotnet nuget push publish/*.nupkg --api-key $NUGET_APIKEY --source https://api.nuget.org/v3/index.json
57+ publish-github-package :
58+ runs-on : ubuntu-latest
59+ needs : build
60+ steps :
61+ - name : Get artifact
62+ uses : actions/download-artifact@v3
63+ with :
64+ name : nuget
65+ - name : Publish NuGet Package to GitHub Package
66+ run : dotnet nuget push ./*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
5767
58- - name : Publish NuGet Package to GitHub Packages
59- if : github.event_name == 'pull_request' || startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/tags/')
60- run : dotnet nuget push publish/*.nupkg --api-key ${{secrets.GITHUB_TOKEN}} --source https://nuget.pkg.github.com/${{github.repository_owner}}/index.json
68+ publish-nuget-org :
69+ if : github.ref_name == 'main'
70+ runs-on : ubuntu-latest
71+ needs : [build, publish-github-package]
72+ steps :
73+ - name : Get artifact
74+ uses : actions/download-artifact@v3
75+ with :
76+ name : nuget
77+ - name : Publish NuGet Package to nuget.org
78+ env :
79+ NUGET_APIKEY : ${{ secrets.NUGET_KEY_NULLFORCE_API }}
80+ run : dotnet nuget push ./*.nupkg --api-key $NUGET_APIKEY --source https://api.nuget.org/v3/index.json
0 commit comments