From dd3c6f32da1240b48814bff95d9f6fe412930d91 Mon Sep 17 00:00:00 2001 From: Peter Krull Date: Thu, 13 Jul 2023 08:59:34 -0600 Subject: [PATCH 1/5] Fix version property of nuget package --- .github/workflows/ci.yml | 2 +- ansys/api/additive/VERSION | 2 +- csharp/Ansys.Api.Additive.csproj | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51518a4..ba4a34f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -132,5 +132,5 @@ jobs: dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/ansys-internal/index.json" version=$(find . -name VERSION -exec cat "{}" \;) rm -rf nuget_package - dotnet pack csharp/Ansys.Api.Additive.csproj -c Release -o nuget_package -p:PackageVersion=${version} + dotnet pack csharp/Ansys.Api.Additive.csproj -c Release -o nuget_package -p:Version=${version} dotnet nuget push nuget_package/*.nupkg --source github diff --git a/ansys/api/additive/VERSION b/ansys/api/additive/VERSION index e2cac26..b966e81 100644 --- a/ansys/api/additive/VERSION +++ b/ansys/api/additive/VERSION @@ -1 +1 @@ -1.2.3 \ No newline at end of file +1.2.4 \ No newline at end of file diff --git a/csharp/Ansys.Api.Additive.csproj b/csharp/Ansys.Api.Additive.csproj index 87b5b47..5794c5a 100644 --- a/csharp/Ansys.Api.Additive.csproj +++ b/csharp/Ansys.Api.Additive.csproj @@ -5,6 +5,7 @@ Ansys.Api.Additive Additive Developers Ansys Inc. + (c) 2023, Ansys Inc. Protobuf definitions for Additive API https://github.com/ansys/ansys-api-additive From 2bd32d4c81a08d1044620229a161a0ad2d5d062a Mon Sep 17 00:00:00 2001 From: Peter Krull Date: Thu, 13 Jul 2023 13:46:44 -0600 Subject: [PATCH 2/5] Refactor build pipeline for nuget package creation --- .github/workflows/ci.yml | 50 ++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba4a34f..e01cdbd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,7 @@ env: MAIN_PYTHON_VERSION: "3.10" PACKAGE_NAME: "ansys.api.additive" DEFINITION_VERSION: "v0" + DOTNET_VERSION: "6.0.x" jobs: build: @@ -57,21 +58,34 @@ jobs: path: dist/ retention-days: 7 + nuget: + name: Build nuget package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup dotnet uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.0.x + dotnet-version: ${{ env.DOTNET_VERSION }} + # Publish - name: Build nuget package run: | dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/ansys-internal/index.json" version=$(find . -name VERSION -exec cat "{}" \;) rm -rf nuget_package - dotnet pack csharp/Ansys.Api.Additive.csproj -c Release -o nuget_package -p:PackageVersion=${version} + dotnet pack csharp/Ansys.Api.Additive.csproj -c Release -o nuget_package -p:Version=${version} + - name: Upload package artifact + uses: actions/upload-artifact@v3 + with: + name: ansys-api-additive-packages + path: nuget_package/ + retention-days: 7 release: if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - needs: [build] + needs: [build, nuget] runs-on: ubuntu-latest steps: - name: Set up Python @@ -105,6 +119,15 @@ jobs: TWINE_PASSWORD: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }} TWINE_REPOSITORY_URL: https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload + - name: Setup dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: Publish nuget package + run: | + dotnet nuget push ./**/*.nupkg --source github + - name: Release uses: softprops/action-gh-release@v1 with: @@ -113,24 +136,5 @@ jobs: ./**/*.whl ./**/*.tar.gz ./**/*.pdf + ./**/*.nupkg - nuget: - if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - name: Publish nuget package - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Setup dotnet - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 6.0.x - - # Publish - - name: Build and publish nuget package - run: | - dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/ansys-internal/index.json" - version=$(find . -name VERSION -exec cat "{}" \;) - rm -rf nuget_package - dotnet pack csharp/Ansys.Api.Additive.csproj -c Release -o nuget_package -p:Version=${version} - dotnet nuget push nuget_package/*.nupkg --source github From 84c2929926ffb77c32dcab38794c745fb70c2919 Mon Sep 17 00:00:00 2001 From: Peter Krull Date: Thu, 13 Jul 2023 13:49:36 -0600 Subject: [PATCH 3/5] Bump action version --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e01cdbd..4c95b41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: - uses: actions/checkout@v2 - name: Setup dotnet - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v3 with: dotnet-version: ${{ env.DOTNET_VERSION }} @@ -120,7 +120,7 @@ jobs: TWINE_REPOSITORY_URL: https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload - name: Setup dotnet - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v3 with: dotnet-version: ${{ env.DOTNET_VERSION }} From 2241040859115fae6d29eaaf20349162313f51ff Mon Sep 17 00:00:00 2001 From: Peter Krull Date: Thu, 13 Jul 2023 13:56:02 -0600 Subject: [PATCH 4/5] Create nuget publish job --- .github/workflows/ci.yml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c95b41..877e081 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,14 +119,6 @@ jobs: TWINE_PASSWORD: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }} TWINE_REPOSITORY_URL: https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload - - name: Setup dotnet - uses: actions/setup-dotnet@v3 - with: - dotnet-version: ${{ env.DOTNET_VERSION }} - - - name: Publish nuget package - run: | - dotnet nuget push ./**/*.nupkg --source github - name: Release uses: softprops/action-gh-release@v1 @@ -138,3 +130,21 @@ jobs: ./**/*.pdf ./**/*.nupkg + publish-nuget-package: + if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + needs: [nuget] + runs-on: ubuntu-latest + steps: + - name: Setup dotnet + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - uses: actions/download-artifact@v3 + + - name: Display structure of downloaded files + run: ls -R + + - name: Publish nuget package + run: | + dotnet nuget push ./**/*.nupkg --source github From cb4f4b11d4bf22cdc36b10f9a2ffc59ae3803e40 Mon Sep 17 00:00:00 2001 From: Peter Krull Date: Thu, 13 Jul 2023 13:58:21 -0600 Subject: [PATCH 5/5] Bump action version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 877e081..e49844c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,7 +62,7 @@ jobs: name: Build nuget package runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup dotnet uses: actions/setup-dotnet@v3