diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 26b93ce..d04bbdf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -108,3 +108,60 @@ 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: {} + if: "! needs.build.outputs.self_mutation_happened" + steps: + - uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 11.x + - uses: actions/setup-node@v3 + with: + node-version: 18.17.1 + - name: Download build artifacts + uses: actions/download-artifact@v3 + with: + name: build-artifact + path: dist + - name: Restore build artifact permissions + run: cd dist && setfacl --restore=permissions-backup.acl + continue-on-error: true + - name: Prepare Repository + run: mv dist .repo + - name: Install Dependencies + run: cd .repo && yarn install --check-files --frozen-lockfile + - 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: {} + if: "! needs.build.outputs.self_mutation_happened" + steps: + - uses: actions/setup-node@v3 + with: + node-version: 18.17.1 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + - name: Download build artifacts + uses: actions/download-artifact@v3 + with: + name: build-artifact + path: dist + - name: Restore build artifact permissions + run: cd dist && setfacl --restore=permissions-backup.acl + continue-on-error: true + - name: Prepare Repository + run: mv dist .repo + - name: Install Dependencies + run: cd .repo && yarn install --check-files --frozen-lockfile + - name: Create python artifact + run: cd .repo && npx projen package:python + - name: Collect python Artifact + run: mv .repo/dist dist diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c968c60..c2d3a4b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -107,3 +107,78 @@ 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.latest_commit == github.sha + steps: + - uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 11.x + - uses: actions/setup-node@v3 + with: + node-version: 18.17.1 + - name: Download build artifacts + uses: actions/download-artifact@v3 + with: + name: build-artifact + path: dist + - name: Restore build artifact permissions + run: cd dist && setfacl --restore=permissions-backup.acl + continue-on-error: true + - name: Prepare Repository + run: mv dist .repo + - name: Install Dependencies + run: cd .repo && yarn install --check-files --frozen-lockfile + - name: Create java artifact + run: cd .repo && npx projen package:java + - name: Collect java Artifact + run: mv .repo/dist dist + - name: Release + env: + MAVEN_ENDPOINT: https://s01.oss.sonatype.org + 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.latest_commit == github.sha + steps: + - uses: actions/setup-node@v3 + with: + node-version: 18.17.1 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + - name: Download build artifacts + uses: actions/download-artifact@v3 + with: + name: build-artifact + path: dist + - name: Restore build artifact permissions + run: cd dist && setfacl --restore=permissions-backup.acl + continue-on-error: true + - name: Prepare Repository + run: mv dist .repo + - name: Install Dependencies + run: cd .repo && yarn install --check-files --frozen-lockfile + - 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 diff --git a/.mergify.yml b/.mergify.yml index 154b39f..b273f5a 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -8,6 +8,8 @@ queue_rules: - -label~=(do-not-merge) - status-success=build - status-success=package-js + - status-success=package-java + - status-success=package-python pull_request_rules: - name: Automatic merge on approval and successful build actions: @@ -24,3 +26,5 @@ pull_request_rules: - -label~=(do-not-merge) - status-success=build - status-success=package-js + - status-success=package-java + - status-success=package-python diff --git a/.projen/tasks.json b/.projen/tasks.json index 4a47264..551dc6a 100644 --- a/.projen/tasks.json +++ b/.projen/tasks.json @@ -163,6 +163,21 @@ "steps": [ { "spawn": "package:js" + }, + { + "spawn": "package:java" + }, + { + "spawn": "package:python" + } + ] + }, + "package:java": { + "name": "package:java", + "description": "Create java language bindings", + "steps": [ + { + "exec": "jsii-pacmak -v --target java" } ] }, @@ -175,6 +190,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/.projenrc.ts b/.projenrc.ts index a052823..2c9ad30 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -23,5 +23,15 @@ const project = new awscdk.AwsCdkConstructLibrary({ secret: 'GITHUB_TOKEN', allowedUsernames: ['yicr'], }, + publishToPypi: { + distName: 'gammarer.aws-waf-geo-restriction-rule-group', + module: 'gammarer.aws_waf_geo_restriction_rule_group', + }, + publishToMaven: { + mavenGroupId: 'com.gammarer', + javaPackage: 'com.gammarer.cdk.aws.waf_geo_restriction_rule_group', + mavenArtifactId: 'aws-waf-geo-restriction-rule-group', + mavenEndpoint: 'https://s01.oss.sonatype.org', + }, }); project.synth(); \ No newline at end of file diff --git a/API.md b/API.md index c0af3e8..6fcb128 100644 --- a/API.md +++ b/API.md @@ -1,3 +1,11 @@ +[![GitHub](https://img.shields.io/github/license/yicr/aws-waf-geo-restriction-rule-group?style=flat-square)](https://github.com/yicr/aws-waf-geo-restriction-rule-group/blob/main/LICENSE) +[![npm (scoped)](https://img.shields.io/npm/v/@gammarer/aws-waf-geo-restriction-rule-group?style=flat-square)](https://www.npmjs.com/package/@gammarer/aws-waf-geo-restriction-rule-group) +[![PyPI](https://img.shields.io/pypi/v/gammarer.aws-waf-geo-restriction-rule-group?style=flat-square)](https://pypi.org/project/gammarer.aws-waf-geo-restriction-rule-group/) + +[![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/com.gammarer/aws-waf-geo-restriction-rule-group?server=https%3A%2F%2Fs01.oss.sonatype.org%2F&style=flat-square)](https://s01.oss.sonatype.org/content/repositories/releases/com/gammarer/aws-waf-geo-restriction-rule-group/) +[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/yicr/aws-waf-geo-restriction-rule-group/release.yml?branch=main&label=release&style=flat-square)](https://github.com/yicr/aws-waf-geo-restriction-rule-group/actions/workflows/release.yml) +[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/yicr/aws-waf-geo-restriction-rule-group?sort=semver&style=flat-square)](https://github.com/yicr/aws-waf-geo-restriction-rule-group/releases) + # AWS WAF(v2) GEO Restriction Rule Group This is an AWS CDK Construct for Geo Restriction Rule Group on WAF V2 @@ -17,6 +25,22 @@ npm install @gammarer/aws-waf-geo-restriction-rule-group # or yarn add @gammarer/aws-waf-geo-restriction-rule-group ``` +### Python + +```shell +pip install gammarer.aws-waf-geo-restriction-rule-group +``` + +### Java + +Add the following to pom.xml: + +```xml + + com.gammarer + aws-waf-geo-restriction-rule-group + +``` ## Example diff --git a/README.md b/README.md index 3f71891..4156675 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ +[![GitHub](https://img.shields.io/github/license/yicr/aws-waf-geo-restriction-rule-group?style=flat-square)](https://github.com/yicr/aws-waf-geo-restriction-rule-group/blob/main/LICENSE) +[![npm (scoped)](https://img.shields.io/npm/v/@gammarer/aws-waf-geo-restriction-rule-group?style=flat-square)](https://www.npmjs.com/package/@gammarer/aws-waf-geo-restriction-rule-group) +[![PyPI](https://img.shields.io/pypi/v/gammarer.aws-waf-geo-restriction-rule-group?style=flat-square)](https://pypi.org/project/gammarer.aws-waf-geo-restriction-rule-group/) + +[![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/com.gammarer/aws-waf-geo-restriction-rule-group?server=https%3A%2F%2Fs01.oss.sonatype.org%2F&style=flat-square)](https://s01.oss.sonatype.org/content/repositories/releases/com/gammarer/aws-waf-geo-restriction-rule-group/) +[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/yicr/aws-waf-geo-restriction-rule-group/release.yml?branch=main&label=release&style=flat-square)](https://github.com/yicr/aws-waf-geo-restriction-rule-group/actions/workflows/release.yml) +[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/yicr/aws-waf-geo-restriction-rule-group?sort=semver&style=flat-square)](https://github.com/yicr/aws-waf-geo-restriction-rule-group/releases) + # AWS WAF(v2) GEO Restriction Rule Group This is an AWS CDK Construct for Geo Restriction Rule Group on WAF V2 @@ -17,6 +25,22 @@ npm install @gammarer/aws-waf-geo-restriction-rule-group # or yarn add @gammarer/aws-waf-geo-restriction-rule-group ``` +### Python + +```shell +pip install gammarer.aws-waf-geo-restriction-rule-group +``` + +### Java + +Add the following to pom.xml: + +```xml + + com.gammarer + aws-waf-geo-restriction-rule-group + +``` ## Example diff --git a/package.json b/package.json index 7e05fbd..177d947 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,9 @@ "eslint": "npx projen eslint", "package": "npx projen package", "package-all": "npx projen package-all", + "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", @@ -119,7 +121,19 @@ "stability": "stable", "jsii": { "outdir": "dist", - "targets": {}, + "targets": { + "java": { + "package": "com.gammarer.cdk.aws.waf_geo_restriction_rule_group", + "maven": { + "groupId": "com.gammarer", + "artifactId": "aws-waf-geo-restriction-rule-group" + } + }, + "python": { + "distName": "gammarer.aws-waf-geo-restriction-rule-group", + "module": "gammarer.aws_waf_geo_restriction_rule_group" + } + }, "tsc": { "outDir": "lib", "rootDir": "src"