@@ -308,6 +308,7 @@ jobs:
308
308
runs-on : ${{ matrix.os }}
309
309
needs : [calc-version]
310
310
env :
311
+ NUGETVER : ${{ needs.calc-version.outputs.nuGetVersionV2 }}
311
312
SEMVER : ${{ needs.calc-version.outputs.semVer }}
312
313
PRERELEASELABEL : ${{ needs.calc-version.outputs.preReleaseLabel }}
313
314
MAJORMINORPATCH : ${{ needs.calc-version.outputs.majorMinorPatch }}
@@ -381,12 +382,32 @@ jobs:
381
382
popd
382
383
dir -r ~/release
383
384
385
+ - name : Package API
386
+ env :
387
+ PACKAGEDIR : ' ${{ github.workspace }}/nupkg/'
388
+ if : ${{ (matrix.os == 'ubuntu-latest') }}
389
+ run : |
390
+ mkdir $PACKAGEDIR
391
+ dotnet pack --no-build -c ${{ env.BUILD_CONFIG }} -o $PACKAGEDIR -p:PackageVersion=${{ env.NUGETVER }}
392
+ ls -lR $PACKAGEDIR
393
+ working-directory : ./src/Api
394
+
384
395
- name : Upload CLI
385
396
386
397
with :
387
398
name : artifacts
388
399
path : ~/release
389
400
retention-days : 7
401
+
402
+ - name : Upload Nuget
403
+ if : ${{ matrix.os == 'ubuntu-latest' }}
404
+
405
+ env :
406
+ PACKAGEDIR : ' ${{ github.workspace }}/nupkg/'
407
+ with :
408
+ name : nuget
409
+ path : ${{ PACKAGEDIR }}*.nupkg
410
+ retention-days : 30
390
411
391
412
- name : Log in to the Container registry
392
413
@@ -501,6 +522,31 @@ jobs:
501
522
name : artifacts
502
523
path : ~/release
503
524
retention-days : 7
525
+
526
+ publish :
527
+ name : Publish to GitHub Packages
528
+ runs-on : ubuntu-latest
529
+ needs : [build, unit-test]
530
+ if : ${{ ! ( github.event.inputs.nuget ) && ! ( contains(github.ref, 'refs/heads/main') ) }}
531
+ steps :
532
+ - uses : actions/download-artifact@v3
533
+ id : download
534
+
535
+ - name : List artifacts
536
+ run : ls -ldR ${{steps.download.outputs.download-path}}/**/*
537
+
538
+ - name : Install grp
539
+ run : dotnet tool install gpr -g
540
+
541
+ - uses : actions/setup-dotnet@v3
542
+ env :
543
+ NUGET_AUTH_TOKEN : ${{secrets.GITHUB_TOKEN}}
544
+ with :
545
+ dotnet-version : " 6.0.x"
546
+ source-url : https://nuget.pkg.github.com/Project-MONAI/index.json
547
+
548
+ - name : Publish to GitHub
549
+ run : gpr push '${{ steps.download.outputs.download-path }}/nuget/*.nupkg' --repository ${{ github.repository }} -k ${{ secrets.GITHUB_TOKEN }}
504
550
505
551
release :
506
552
if : ${{ contains(github.ref, 'refs/heads/main') || contains(github.ref, 'refs/heads/develop') ||contains(github.head_ref, 'release/') || contains(github.head_ref, 'feature/') || contains(github.head_ref, 'develop') }}
@@ -521,6 +567,22 @@ jobs:
521
567
522
568
- name : List artifacts
523
569
run : ls -ldR ${{steps.download.outputs.download-path}}/**/*
570
+
571
+ - name : Install grp
572
+ run : dotnet tool install gpr -g
573
+
574
+ - uses : actions/setup-dotnet@v3
575
+ env :
576
+ NUGET_AUTH_TOKEN : ${{secrets.GITHUB_TOKEN}}
577
+ with :
578
+ dotnet-version : " 6.0.x"
579
+ source-url : https://nuget.pkg.github.com/Project-MONAI/index.json
580
+
581
+ - name : Publish to GitHub
582
+ run : gpr push '${{ steps.download.outputs.download-path }}/nuget/*.nupkg' --repository ${{ github.repository }} -k ${{ secrets.GITHUB_TOKEN }}
583
+
584
+ - name : Publish to NuGet.org
585
+ run : dotnet nuget push ${{ steps.download.outputs.download-path }}/nuget/*.nupkg -s https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET }} --skip-duplicate
524
586
525
587
- name : Extract owner and repo
526
588
uses : jungwinter/split@v2
0 commit comments