From 03b71af1ec5a2a697abac8a446c5da855bb39ca6 Mon Sep 17 00:00:00 2001 From: yicr Date: Tue, 12 Dec 2023 11:02:58 +0900 Subject: [PATCH 1/3] feat: setting publish to nuget --- .github/workflows/build.yml | 28 ++++++++++++++++++++++++++++ .github/workflows/release.yml | 34 ++++++++++++++++++++++++++++++++++ .mergify.yml | 2 ++ .projen/tasks.json | 12 ++++++++++++ .projenrc.ts | 4 ++++ package.json | 5 +++++ 6 files changed, 85 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d04bbdf..47490f0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -165,3 +165,31 @@ 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: {} + if: "! needs.build.outputs.self_mutation_happened" + steps: + - uses: actions/setup-node@v3 + with: + node-version: 18.17.1 + - uses: actions/setup-dotnet@v3 + with: + dotnet-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 dotnet artifact + run: cd .repo && npx projen package:dotnet + - name: Collect dotnet Artifact + run: mv .repo/dist dist diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c2d3a4b..4aa443d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -182,3 +182,37 @@ 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 + if: needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-node@v3 + with: + node-version: 18.17.1 + - uses: actions/setup-dotnet@v3 + with: + dotnet-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 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/.mergify.yml b/.mergify.yml index b273f5a..f87dd04 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -10,6 +10,7 @@ queue_rules: - 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: @@ -28,3 +29,4 @@ pull_request_rules: - status-success=package-js - status-success=package-java - status-success=package-python + - status-success=package-dotnet diff --git a/.projen/tasks.json b/.projen/tasks.json index 367209f..12d5bfb 100644 --- a/.projen/tasks.json +++ b/.projen/tasks.json @@ -169,6 +169,18 @@ }, { "spawn": "package:python" + }, + { + "spawn": "package:dotnet" + } + ] + }, + "package:dotnet": { + "name": "package:dotnet", + "description": "Create dotnet language bindings", + "steps": [ + { + "exec": "jsii-pacmak -v --target dotnet" } ] }, diff --git a/.projenrc.ts b/.projenrc.ts index 85edd56..9690d4f 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -33,5 +33,9 @@ const project = new awscdk.AwsCdkConstructLibrary({ mavenArtifactId: 'aws-waf-ip-restriction-rule-group', mavenEndpoint: 'https://s01.oss.sonatype.org', }, + publishToNuget: { + dotNetNamespace: 'Gammarer.CDK.AWS', + packageId: 'Gammarer.CDK.AWS.WafIpRestrictionRuleGroup', + }, }); project.synth(); \ No newline at end of file diff --git a/package.json b/package.json index 4c7ba77..dbdf914 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "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", @@ -130,6 +131,10 @@ "python": { "distName": "gammarer.aws-waf-ip-restriction-rule-group", "module": "gammarer.aws_waf_ip_restriction_rule_group" + }, + "dotnet": { + "namespace": "Gammarer.CDK.AWS", + "packageId": "Gammarer.CDK.AWS.WafIpRestrictionRuleGroup" } }, "tsc": { From 27d8796aa334ee5c10013e572720624753dbdab4 Mon Sep 17 00:00:00 2001 From: yicr Date: Tue, 12 Dec 2023 11:09:37 +0900 Subject: [PATCH 2/3] chore: update readme(add install for .net with nuget budge) --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2535bf0..7515c7e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![GitHub](https://img.shields.io/github/license/yicr/aws-waf-ip-restriction-rule-group?style=flat-square)](https://github.com/yicr/aws-waf-ip-restriction-rule-group/blob/main/LICENSE) [![npm (scoped)](https://img.shields.io/npm/v/@gammarer/aws-waf-ip-restriction-rule-group?style=flat-square)](https://www.npmjs.com/package/@gammarer/aws-waf-ip-restriction-rule-group) [![PyPI](https://img.shields.io/pypi/v/gammarer.aws-waf-ip-restriction-rule-group?style=flat-square)](https://pypi.org/project/gammarer.aws-waf-ip-restriction-rule-group/) - +[![Nuget](https://img.shields.io/nuget/v/Gammarer.CDK.AWS.WafIpRestrictionRuleGroup?style=flat-square)](https://www.nuget.org/packages/Gammarer.CDK.AWS.WafIpRestrictionRuleGroup/) [![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/com.gammarer/aws-waf-ip-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-ip-restriction-rule-group/) [![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/yicr/aws-waf-ip-restriction-rule-group/release.yml?branch=main&label=release&style=flat-square)](https://github.com/yicr/aws-waf-ip-restriction-rule-group/actions/workflows/release.yml) [![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/yicr/aws-waf-ip-restriction-rule-group?sort=semver&style=flat-square)](https://github.com/yicr/aws-waf-ip-restriction-rule-group/releases) @@ -32,6 +32,12 @@ yarn add @gammarer/aws-waf-ip-restriction-rule-group pip install gammarer.aws-waf-ip-restriction-rule-group ``` +### C# / .Net + +```shell +dotnet add package Gammarer.CDK.AWS.WafIpRestrictionRuleGroup +``` + ### Java Add the following to pom.xml: From 05eaa7f1a1b27e29cacd14aaa96bb3d48bbd8cee Mon Sep 17 00:00:00 2001 From: github-actions Date: Tue, 12 Dec 2023 02:21:26 +0000 Subject: [PATCH 3/3] chore: self mutation Signed-off-by: github-actions --- API.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/API.md b/API.md index 9f56ae6..f292dd0 100644 --- a/API.md +++ b/API.md @@ -1,7 +1,7 @@ [![GitHub](https://img.shields.io/github/license/yicr/aws-waf-ip-restriction-rule-group?style=flat-square)](https://github.com/yicr/aws-waf-ip-restriction-rule-group/blob/main/LICENSE) [![npm (scoped)](https://img.shields.io/npm/v/@gammarer/aws-waf-ip-restriction-rule-group?style=flat-square)](https://www.npmjs.com/package/@gammarer/aws-waf-ip-restriction-rule-group) [![PyPI](https://img.shields.io/pypi/v/gammarer.aws-waf-ip-restriction-rule-group?style=flat-square)](https://pypi.org/project/gammarer.aws-waf-ip-restriction-rule-group/) - +[![Nuget](https://img.shields.io/nuget/v/Gammarer.CDK.AWS.WafIpRestrictionRuleGroup?style=flat-square)](https://www.nuget.org/packages/Gammarer.CDK.AWS.WafIpRestrictionRuleGroup/) [![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/com.gammarer/aws-waf-ip-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-ip-restriction-rule-group/) [![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/yicr/aws-waf-ip-restriction-rule-group/release.yml?branch=main&label=release&style=flat-square)](https://github.com/yicr/aws-waf-ip-restriction-rule-group/actions/workflows/release.yml) [![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/yicr/aws-waf-ip-restriction-rule-group?sort=semver&style=flat-square)](https://github.com/yicr/aws-waf-ip-restriction-rule-group/releases) @@ -32,6 +32,12 @@ yarn add @gammarer/aws-waf-ip-restriction-rule-group pip install gammarer.aws-waf-ip-restriction-rule-group ``` +### C# / .Net + +```shell +dotnet add package Gammarer.CDK.AWS.WafIpRestrictionRuleGroup +``` + ### Java Add the following to pom.xml: