diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 092a9eda..1b01d7ac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -172,3 +172,31 @@ jobs: run: cd .repo && npx projen package:dotnet - name: Collect dotnet Artifact run: mv .repo/dist dist + package-go: + needs: build + runs-on: ubuntu-latest + permissions: {} + if: "! needs.build.outputs.self_mutation_happened" + steps: + - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 + with: + node-version: 20.x + - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 + with: + go-version: ^1.18.0 + - name: Download build artifacts + uses: actions/download-artifact@b4aefff88e83a2676a730654e1ce3dce61880379 + 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 go artifact + run: cd .repo && npx projen package:go + - name: Collect go Artifact + run: mv .repo/dist dist diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aba868c8..f58b0b9a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -67,6 +67,7 @@ jobs: - release_npm - release_pypi - release_nuget + - release_golang runs-on: ubuntu-latest permissions: contents: write @@ -197,3 +198,39 @@ jobs: 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 + 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@60edb5dd545a775178f52524783378180af0d1f8 + with: + node-version: 20.x + - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 + with: + go-version: ^1.18.0 + - name: Download build artifacts + uses: actions/download-artifact@b4aefff88e83a2676a730654e1ce3dce61880379 + 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 go artifact + run: cd .repo && npx projen package:go + - name: Collect go Artifact + run: mv .repo/dist dist + - name: Release + env: + GIT_USER_NAME: github-actions + GIT_USER_EMAIL: github-actions@github.com + GITHUB_TOKEN: ${{ secrets.GO_GITHUB_TOKEN }} + run: npx -p publib@latest publib-golang diff --git a/.mergify.yml b/.mergify.yml index b4e099da..8554e273 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -10,6 +10,7 @@ queue_rules: - status-success=package-js - status-success=package-python - status-success=package-dotnet + - status-success=package-go 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-python - status-success=package-dotnet + - status-success=package-go diff --git a/.projen/tasks.json b/.projen/tasks.json index d9ff13f5..62c4d42b 100644 --- a/.projen/tasks.json +++ b/.projen/tasks.json @@ -189,6 +189,9 @@ }, { "spawn": "package:dotnet" + }, + { + "spawn": "package:go" } ] }, @@ -201,6 +204,15 @@ } ] }, + "package:go": { + "name": "package:go", + "description": "Create go language bindings", + "steps": [ + { + "exec": "jsii-pacmak -v --target go" + } + ] + }, "package:js": { "name": "package:js", "description": "Create js language bindings", diff --git a/.projenrc.ts b/.projenrc.ts index d0533720..0ca39d68 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -90,6 +90,10 @@ const project = new awscdk.AwsCdkConstructLibrary({ packageId: camelCaseIt(PUBLICATION_NAMESPACE)+'.'+camelCaseIt(PROJECT_NAME), }, + publishToGo: { + moduleName: `github.com/${PUBLICATION_NAMESPACE}/${PROJECT_NAME}-go`, + }, + codeCov: true, codeCovTokenSecret: 'CODECOV_TOKEN', @@ -150,6 +154,7 @@ project.github?.actions.set('actions/download-artifact@v4', 'actions/download-ar project.github?.actions.set('actions/github-script@v6', 'actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410'); project.github?.actions.set('actions/setup-dotnet@v3', 'actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3'); project.github?.actions.set('actions/setup-dotnet@v4', 'actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3'); +project.github?.actions.set('actions/setup-go@v5', 'actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32'); project.github?.actions.set('actions/setup-node@v3', 'actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8'); // https://github.com/projen/projen/issues/3529 project.github?.actions.set('actions/setup-node@v4', 'actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8'); project.github?.actions.set('actions/setup-python@v4', 'actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d'); // https://github.com/projen/projen/issues/3529 diff --git a/README.md b/README.md index 8602abd2..f98a37a3 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ [![PyPI version](https://img.shields.io/pypi/v/cdklabs.generative-ai-cdk-constructs)](https://pypi.org/project/cdklabs.generative-ai-cdk-constructs/) [![npm version](https://img.shields.io/npm/v/@cdklabs/generative-ai-cdk-constructs)](https://www.npmjs.com/package/@cdklabs/generative-ai-cdk-constructs) [![NuGet Version](https://img.shields.io/nuget/v/Cdklabs.GenerativeAiCdkConstructs)](https://nuget.info/packages/Cdklabs.GenerativeAiCdkConstructs) +[![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/cdklabs/generative-ai-cdk-constructs-go?filename=generative-ai-cdk-constructs%2Fgo.mod)(https://github.com/cdklabs/generative-ai-cdk-constructs-go)] ## Table of contents @@ -77,6 +78,16 @@ If you want to add a new construct to the library, check out our [design guideli - Use the namespace: - `using Cdklabs.GenerativeAiCdkConstructs;` +### For Go +- Create or use an existing CDK application in Python + - `cdk init app --language go` +- Get the module: + - `go get github.com/cdklabs/generative-ai-cdk-constructs-go/generative-ai-cdk-constructs` +- Import the library: + - `import "github.com/cdklabs/generative-ai-cdk-constructs-go/generative-ai-cdk-constructs"` + +_NOTE: The [Go distribution repository](https://github.com/cdklabs/generative-ai-cdk-constructs-go), distributes the JSII tar gzipped versioned source from the [source repository](https://github.awslabs/generative-ai-cdk-constructs)_ + Refer to the documentation for additional guidance on a particular construct: [Catalog](#catalog) ## Catalog diff --git a/package.json b/package.json index 9ada539b..9b1d2841 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "package": "npx projen package", "package-all": "npx projen package-all", "package:dotnet": "npx projen package:dotnet", + "package:go": "npx projen package:go", "package:js": "npx projen package:js", "package:python": "npx projen package:python", "post-compile": "npx projen post-compile", @@ -156,6 +157,9 @@ "dotnet": { "namespace": "Cdklabs.GenerativeAiCdkConstructs", "packageId": "Cdklabs.GenerativeAiCdkConstructs" + }, + "go": { + "moduleName": "github.com/cdklabs/generative-ai-cdk-constructs-go" } }, "tsc": {