diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a910f6284..8dd2002d4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -176,6 +176,44 @@ jobs: run: cd .repo && npx projen package:python - name: Collect python artifact run: mv .repo/dist dist + package-dotnet: + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + if: ${{ !needs.build.outputs.self_mutation_happened }} + steps: + - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e + with: + node-version: 20.16.0 + package-manager-cache: "false" + - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 + with: + dotnet-version: 6.x + - name: Download build artifacts + uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e + with: + name: build-artifact + path: dist + - name: Restore build artifact permissions + run: cd dist && setfacl --restore=permissions-backup.acl + continue-on-error: true + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + path: .repo + - name: Install Dependencies + run: cd .repo && yarn install --check-files --frozen-lockfile + - name: Extract build artifact + run: tar --strip-components=1 -xzvf dist/js/*.tgz -C .repo + - name: Move build artifact out of the way + run: mv dist dist.old + - name: Create dotnet artifact + run: cd .repo && npx projen package:dotnet + - name: Collect dotnet artifact + run: mv .repo/dist dist package-go: needs: build runs-on: ubuntu-latest diff --git a/.github/workflows/force-release.yml b/.github/workflows/force-release.yml index cb1e10e3a..7938b8a11 100644 --- a/.github/workflows/force-release.yml +++ b/.github/workflows/force-release.yml @@ -185,6 +185,48 @@ jobs: TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} run: npx -p publib@latest publib-pypi + release_nuget: + name: Publish to NuGet Gallery + needs: release + runs-on: ubuntu-latest + permissions: + contents: read + issues: write + if: ${{ inputs.publish_to_nuget }} + steps: + - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e + with: + node-version: 20.16.0 + package-manager-cache: "false" + - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 + with: + dotnet-version: 6.x + - name: Download build artifacts + uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e + with: + name: build-artifact + path: dist + - name: Restore build artifact permissions + run: cd dist && setfacl --restore=permissions-backup.acl + continue-on-error: true + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + with: + path: .repo + - name: Install Dependencies + run: cd .repo && yarn install --check-files --frozen-lockfile + - name: Extract build artifact + run: tar --strip-components=1 -xzvf dist/js/*.tgz -C .repo + - name: Move build artifact out of the way + run: mv dist dist.old + - name: Create dotnet artifact + run: cd .repo && npx projen package:dotnet + - name: Collect dotnet artifact + run: mv .repo/dist dist + - name: Release + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + run: npx -p publib@latest publib-nuget release_golang: name: Publish to GitHub Go Module Repository needs: release diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0b11c0873..c4b0ac38f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -237,6 +237,60 @@ jobs: VERSION: ${{ steps.extract-version.outputs.VERSION }} RUN_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} run: gh issue create --title "Publishing v$VERSION to PyPI failed" --body "See $RUN_URL" --label "failed-release" + release_nuget: + name: Publish to NuGet Gallery + needs: release + runs-on: ubuntu-latest + permissions: + contents: read + issues: write + if: needs.release.outputs.tag_exists != 'true' && needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e + with: + node-version: 20.16.0 + package-manager-cache: "false" + - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 + with: + dotnet-version: 6.x + - name: Download build artifacts + uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e + with: + name: build-artifact + path: dist + - name: Restore build artifact permissions + run: cd dist && setfacl --restore=permissions-backup.acl + continue-on-error: true + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + with: + path: .repo + - name: Install Dependencies + run: cd .repo && yarn install --check-files --frozen-lockfile + - name: Extract build artifact + run: tar --strip-components=1 -xzvf dist/js/*.tgz -C .repo + - name: Move build artifact out of the way + run: mv dist dist.old + - name: Create dotnet artifact + run: cd .repo && npx projen package:dotnet + - name: Collect dotnet artifact + run: mv .repo/dist dist + - name: Release + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + run: npx -p publib@latest publib-nuget + - name: Extract Version + id: extract-version + if: ${{ failure() }} + run: echo "VERSION=$(cat dist/version.txt)" >> $GITHUB_OUTPUT + shell: bash + - name: Create Issue + if: ${{ failure() }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ steps.extract-version.outputs.VERSION }} + RUN_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + run: gh issue create --title "Publishing v$VERSION to NuGet Gallery failed" --body "See $RUN_URL" --label "failed-release" release_golang: name: Publish to GitHub Go Module Repository needs: release diff --git a/.projen/tasks.json b/.projen/tasks.json index 0a95c62a8..741bdbc7c 100644 --- a/.projen/tasks.json +++ b/.projen/tasks.json @@ -186,11 +186,23 @@ { "spawn": "package:python" }, + { + "spawn": "package:dotnet" + }, { "spawn": "package:go" } ] }, + "package:dotnet": { + "name": "package:dotnet", + "description": "Create dotnet language bindings", + "steps": [ + { + "exec": "jsii-pacmak -v --target dotnet" + } + ] + }, "package:go": { "name": "package:go", "description": "Create go language bindings", diff --git a/package.json b/package.json index bfe3a1805..c8890a55e 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "fetch": "projen fetch", "package": "projen package", "package-all": "projen package-all", + "package:dotnet": "projen package:dotnet", "package:go": "projen package:go", "package:js": "projen package:js", "package:python": "projen package:python", @@ -98,6 +99,10 @@ "distName": "cdktn-provider-github", "module": "cdktn_provider_github" }, + "dotnet": { + "namespace": "Io.Cdktn.Providers.Github", + "packageId": "Io.Cdktn.Providers.Github" + }, "go": { "moduleName": "github.com/cdktn-io/cdktn-provider-github-go", "packageName": "github" diff --git a/yarn.lock b/yarn.lock index abbeae754..b355f044c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -227,9 +227,9 @@ glob "10.5.0" "@cdktn/provider-project@^0.7.0": - version "0.7.33" - resolved "https://registry.yarnpkg.com/@cdktn/provider-project/-/provider-project-0.7.33.tgz#cda633f4b304ad68d1545edd61eeb739c32e0a45" - integrity sha512-5nhwj94Jxltpz0iJqunarcSa43Z4GyGBx69glzIuJ+DsajZCNAF2XGBWurmktcD+89Eu/OlvHNqBr9Nr7IdXww== + version "0.7.34" + resolved "https://registry.yarnpkg.com/@cdktn/provider-project/-/provider-project-0.7.34.tgz#a972a93d7a3aa64be286d3c0f710bfd812dcb721" + integrity sha512-zFkLqwRDusejW6gCcOnTJiRJwz+2RucxxxalqvAVTUOqmofjFTHfI4JtswsqjEiu125HVG3qYVJuhq6mCCMIqw== dependencies: change-case "^4.1.2" fs-extra "^10.1.0"