diff --git a/src/cdk-construct/.github/workflows/build.yml b/src/cdk-construct/.github/workflows/build.yml index eced1272..a3443fab 100644 --- a/src/cdk-construct/.github/workflows/build.yml +++ b/src/cdk-construct/.github/workflows/build.yml @@ -120,3 +120,115 @@ jobs: run: cd .repo && npx projen package:js - name: Collect js artifact run: mv .repo/dist dist + package-java: + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + if: ${{ !needs.build.outputs.self_mutation_happened }} + steps: + - uses: actions/setup-java@v4 + with: + distribution: corretto + java-version: "11" + - uses: actions/setup-node@v4 + with: + node-version: 18.x + - name: Download build artifacts + uses: actions/download-artifact@v4 + 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@v4 + 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 java artifact + run: cd .repo && npx projen package:java + - name: Collect java artifact + run: mv .repo/dist dist + package-python: + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + if: ${{ !needs.build.outputs.self_mutation_happened }} + steps: + - uses: actions/setup-node@v4 + with: + node-version: 18.x + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - name: Download build artifacts + uses: actions/download-artifact@v4 + 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@v4 + 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 python artifact + 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@v4 + with: + node-version: 18.x + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: 6.x + - name: Download build artifacts + uses: actions/download-artifact@v4 + 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@v4 + 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 diff --git a/src/cdk-construct/.github/workflows/release.yml b/src/cdk-construct/.github/workflows/release.yml index acf91249..0f0b93ac 100644 --- a/src/cdk-construct/.github/workflows/release.yml +++ b/src/cdk-construct/.github/workflows/release.yml @@ -63,6 +63,9 @@ jobs: needs: - release - release_npm + - release_maven + - release_pypi + - release_nuget runs-on: ubuntu-latest permissions: contents: write @@ -124,3 +127,129 @@ jobs: NPM_REGISTRY: registry.npmjs.org NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: npx -p publib@latest publib-npm + release_maven: + name: Publish to Maven Central + needs: release + runs-on: ubuntu-latest + permissions: + contents: read + if: needs.release.outputs.tag_exists != 'true' && needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-java@v4 + with: + distribution: corretto + java-version: "11" + - uses: actions/setup-node@v4 + with: + node-version: 18.x + - name: Download build artifacts + uses: actions/download-artifact@v4 + 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@v4 + 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 java artifact + run: cd .repo && npx projen package:java + - name: Collect java artifact + run: mv .repo/dist dist + - name: Release + env: + MAVEN_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + MAVEN_GPG_PRIVATE_KEY_PASSPHRASE: ${{ secrets.MAVEN_GPG_PRIVATE_KEY_PASSPHRASE }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_STAGING_PROFILE_ID: ${{ secrets.MAVEN_STAGING_PROFILE_ID }} + run: npx -p publib@latest publib-maven + release_pypi: + name: Publish to PyPI + needs: release + runs-on: ubuntu-latest + permissions: + contents: read + if: needs.release.outputs.tag_exists != 'true' && needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-node@v4 + with: + node-version: 18.x + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - name: Download build artifacts + uses: actions/download-artifact@v4 + 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@v4 + 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 python artifact + run: cd .repo && npx projen package:python + - name: Collect python artifact + run: mv .repo/dist dist + - name: Release + env: + 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 + if: needs.release.outputs.tag_exists != 'true' && needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-node@v4 + with: + node-version: 18.x + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: 6.x + - name: Download build artifacts + uses: actions/download-artifact@v4 + 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@v4 + 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 diff --git a/src/cdk-construct/.mergify.yml b/src/cdk-construct/.mergify.yml index 154b39fa..f87dd048 100644 --- a/src/cdk-construct/.mergify.yml +++ b/src/cdk-construct/.mergify.yml @@ -8,6 +8,9 @@ queue_rules: - -label~=(do-not-merge) - status-success=build - status-success=package-js + - status-success=package-java + - status-success=package-python + - status-success=package-dotnet pull_request_rules: - name: Automatic merge on approval and successful build actions: @@ -24,3 +27,6 @@ pull_request_rules: - -label~=(do-not-merge) - status-success=build - status-success=package-js + - status-success=package-java + - status-success=package-python + - status-success=package-dotnet diff --git a/src/cdk-construct/.projen/tasks.json b/src/cdk-construct/.projen/tasks.json index 07d7c951..d3cd77f2 100644 --- a/src/cdk-construct/.projen/tasks.json +++ b/src/cdk-construct/.projen/tasks.json @@ -173,6 +173,33 @@ "steps": [ { "spawn": "package:js" + }, + { + "spawn": "package:java" + }, + { + "spawn": "package:python" + }, + { + "spawn": "package:dotnet" + } + ] + }, + "package:dotnet": { + "name": "package:dotnet", + "description": "Create dotnet language bindings", + "steps": [ + { + "exec": "jsii-pacmak -v --target dotnet" + } + ] + }, + "package:java": { + "name": "package:java", + "description": "Create java language bindings", + "steps": [ + { + "exec": "jsii-pacmak -v --target java" } ] }, @@ -185,6 +212,15 @@ } ] }, + "package:python": { + "name": "package:python", + "description": "Create python language bindings", + "steps": [ + { + "exec": "jsii-pacmak -v --target python" + } + ] + }, "post-compile": { "name": "post-compile", "description": "Runs after successful compilation", diff --git a/src/cdk-construct/.projenrc.ts b/src/cdk-construct/.projenrc.ts index 66f1041d..1ba40a6b 100644 --- a/src/cdk-construct/.projenrc.ts +++ b/src/cdk-construct/.projenrc.ts @@ -13,6 +13,20 @@ const project = new awscdk.AwsCdkConstructLibrary({ // description: undefined, /* The description is just a string that helps people understand the purpose of the package. */ // devDeps: [], /* Build dependencies for this module. */ // packageName: undefined, /* The "name" in package.json. */ + + publishToMaven: { + mavenArtifactId: 'lambdadispatch-cdk', + javaPackage: 'com.pwrdrvr.lambdadispatch.cdk', + mavenGroupId: 'com.pwrdrvr.lambdadispatch', + }, + publishToNuget: { + dotNetNamespace: 'PwrDrvr.LambdaDispatch.CDK', + packageId: 'PwrDrvr.LambdaDispatch.CDK', + }, + publishToPypi: { + distName: 'pwrdrvr.lambdadispatch.cdk', + module: 'pwrdrvr.lambdadispatch.cdk', + }, }); project.compileTask.exec('cp DockerfileLambda lib/DockerfileLambda'); diff --git a/src/cdk-construct/package.json b/src/cdk-construct/package.json index 4091f54e..895c3849 100644 --- a/src/cdk-construct/package.json +++ b/src/cdk-construct/package.json @@ -16,7 +16,10 @@ "eslint": "npx projen eslint", "package": "npx projen package", "package-all": "npx projen package-all", + "package:dotnet": "npx projen package:dotnet", + "package:java": "npx projen package:java", "package:js": "npx projen package:js", + "package:python": "npx projen package:python", "post-compile": "npx projen post-compile", "post-upgrade": "npx projen post-upgrade", "pre-compile": "npx projen pre-compile", @@ -115,7 +118,23 @@ "stability": "stable", "jsii": { "outdir": "dist", - "targets": {}, + "targets": { + "java": { + "package": "com.pwrdrvr.lambdadispatch.cdk", + "maven": { + "groupId": "com.pwrdrvr.lambdadispatch", + "artifactId": "lambdadispatch-cdk" + } + }, + "python": { + "distName": "pwrdrvr.lambdadispatch.cdk", + "module": "pwrdrvr.lambdadispatch.cdk" + }, + "dotnet": { + "namespace": "PwrDrvr.LambdaDispatch.CDK", + "packageId": "PwrDrvr.LambdaDispatch.CDK" + } + }, "tsc": { "outDir": "lib", "rootDir": "src"