File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed
Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 55 CODECOV_TOKEN :
66 description : Token for uploading code coverage metrics to CodeCov.io.
77 required : true
8+ NUGET_API_KEY :
9+ description : Token for publishing packages to NuGet.
10+ required : true
811jobs :
912 build :
1013 runs-on : ubuntu-latest
1114 steps :
12- - uses : actions/checkout@v4
15+ - name : Checkout
16+ uses : actions/checkout@v4
1317 - name : Setup .NET 6
1418 uses : actions/setup-dotnet@v4
1519 with :
2428 dotnet-version : 8.0.x
2529 - name : Build and test
2630 run : dotnet msbuild ./default.proj
27- - uses : codecov/codecov-action@v5
31+ - name : Upload coverage
32+ uses : codecov/codecov-action@v5
2833 with :
2934 fail_ci_if_error : true
3035 files : artifacts/logs/*/coverage.cobertura.xml
3136 token : ${{ secrets.CODECOV_TOKEN }}
32- # TODO: Upload to GitHub packages instead of MyGet in GitHub actions for master and develop.
37+ - name : Publish to GitHub Packages
38+ if : ${{ github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/v') }}
39+ run : |
40+ dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/autofac/index.json"
41+ dotnet nuget push ./artifacts/packages/*.nupkg --source github --api-key ${{ secrets.GITHUB_TOKEN }}
42+ - name : Publish to NuGet
43+ if : ${{ startsWith(github.ref, 'refs/tags/v') }}
44+ run : |
45+ # Ensure the tag is on the master branch.
46+ git branch --remote --contains | grep origin/master
47+
48+ # Push to NuGet.
49+ dotnet nuget push ./artifacts/packages/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
Original file line number Diff line number Diff line change 55 - develop
66 - master
77 push :
8+ branches :
9+ - develop
10+ - master
11+ - feature/*
12+ tags :
13+ - v[0-9]+.[0-9]+.[0-9]+
814# If multiple pushes happen quickly in succession, cancel the running build and
915# start a new one.
1016concurrency :
2127 uses : ./.github/workflows/build.yml
2228 secrets :
2329 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
30+ NUGET_API_KEY : ${{ secrets.NUGET_API_KEY }}
You can’t perform that action at this time.
0 commit comments