diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 875e527a8..d92b00f1a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -308,6 +308,7 @@ jobs: runs-on: ${{ matrix.os }} needs: [calc-version] env: + NUGETVER: ${{ needs.calc-version.outputs.nuGetVersionV2 }} SEMVER: ${{ needs.calc-version.outputs.semVer }} PRERELEASELABEL: ${{ needs.calc-version.outputs.preReleaseLabel }} MAJORMINORPATCH: ${{ needs.calc-version.outputs.majorMinorPatch }} @@ -381,12 +382,32 @@ jobs: popd dir -r ~/release + - name: Package API + env: + PACKAGEDIR: '${{ github.workspace }}/nupkg/' + if: ${{ (matrix.os == 'ubuntu-latest') }} + run: | + mkdir $PACKAGEDIR + dotnet pack --no-build -c ${{ env.BUILD_CONFIG }} -o $PACKAGEDIR -p:PackageVersion=${{ env.NUGETVER }} + ls -lR $PACKAGEDIR + working-directory: ./src/Api + - name: Upload CLI uses: actions/upload-artifact@v3.1.2 with: name: artifacts path: ~/release retention-days: 7 + + - name: Upload Nuget + if: ${{ matrix.os == 'ubuntu-latest' }} + uses: actions/upload-artifact@v3.1.2 + env: + PACKAGEDIR: '${{ github.workspace }}/nupkg/' + with: + name: nuget + path: ${{ PACKAGEDIR }}*.nupkg + retention-days: 30 - name: Log in to the Container registry uses: docker/login-action@v2.2.0 @@ -501,6 +522,31 @@ jobs: name: artifacts path: ~/release retention-days: 7 + + publish: + name: Publish to GitHub Packages + runs-on: ubuntu-latest + needs: [build, unit-test] + if: ${{ ! ( github.event.inputs.nuget ) && ! ( contains(github.ref, 'refs/heads/main') ) }} + steps: + - uses: actions/download-artifact@v3 + id: download + + - name: List artifacts + run: ls -ldR ${{steps.download.outputs.download-path}}/**/* + + - name: Install grp + run: dotnet tool install gpr -g + + - uses: actions/setup-dotnet@v3 + env: + NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + dotnet-version: "6.0.x" + source-url: https://nuget.pkg.github.com/Project-MONAI/index.json + + - name: Publish to GitHub + run: gpr push '${{ steps.download.outputs.download-path }}/nuget/*.nupkg' --repository ${{ github.repository }} -k ${{ secrets.GITHUB_TOKEN }} release: 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: - name: List artifacts run: ls -ldR ${{steps.download.outputs.download-path}}/**/* + + - name: Install grp + run: dotnet tool install gpr -g + + - uses: actions/setup-dotnet@v3 + env: + NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + dotnet-version: "6.0.x" + source-url: https://nuget.pkg.github.com/Project-MONAI/index.json + + - name: Publish to GitHub + run: gpr push '${{ steps.download.outputs.download-path }}/nuget/*.nupkg' --repository ${{ github.repository }} -k ${{ secrets.GITHUB_TOKEN }} + + - name: Publish to NuGet.org + 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 - name: Extract owner and repo uses: jungwinter/split@v2 diff --git a/src/Api/Monai.Deploy.InformaticsGateway.Api.csproj b/src/Api/Monai.Deploy.InformaticsGateway.Api.csproj index 45105d047..f4ada69d4 100644 --- a/src/Api/Monai.Deploy.InformaticsGateway.Api.csproj +++ b/src/Api/Monai.Deploy.InformaticsGateway.Api.csproj @@ -25,8 +25,23 @@ true enable false + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + + Monai.Deploy.InformaticsGateway.Api + 0.4.1 + MONAI Consortium + MONAI Consortium + true + MONAI Deploy Informatics Gateway API + MONAI Consortium + https://github.com/Project-MONAI/monai-deploy-informatics-gateway + https://github.com/Project-MONAI/monai-deploy-informatics-gateway + Apache-2.0 + True + +