From 65d91cbae31e0d2b3b8f618b242787150dcbdeb3 Mon Sep 17 00:00:00 2001 From: Dinesh Sajwan Date: Fri, 14 Jun 2024 10:16:20 -0400 Subject: [PATCH 1/7] feat(dontversion): publish constructs to NuGet --- .projenrc.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.projenrc.ts b/.projenrc.ts index a38fd4d7..466e31e4 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -15,6 +15,7 @@ import { JsonPatch, awscdk } from 'projen'; import { DependabotScheduleInterval, VersioningStrategy } from 'projen/lib/github'; import { JobPermission } from 'projen/lib/github/workflows-model'; import { NpmAccess } from 'projen/lib/javascript'; +import { ReleaseTrigger } from 'projen/lib/release'; import { buildUpgradeMainPRCustomJob } from './projenrc/github-jobs'; import { buildMeritBadgerWorkflow, @@ -75,12 +76,20 @@ const project = new awscdk.AwsCdkConstructLibrary({ npmTokenSecret: 'NPM_TOKEN', npmAccess: NpmAccess.PUBLIC, + // Manual release, remove once NuGet Account is activated + releaseTrigger: ReleaseTrigger.manual(), + publishToPypi: { distName: PUBLICATION_NAMESPACE+'.'+PROJECT_NAME, module: (PUBLICATION_NAMESPACE.replace(/-/g, '_'))+'.'+(PROJECT_NAME.replace(/-/g, '_')), // PEP 8, convert hypens // twineRegistryUrl: '${{ secrets.TWINE_REGISTRY_URL }}', }, + publishToNuget: { + dotNetNamespace: PUBLICATION_NAMESPACE+'.'+PROJECT_NAME.replace(/-/g, '_'), + packageId: PUBLICATION_NAMESPACE+'.'+PROJECT_NAME.replace(/-/g, '_'), + }, + codeCov: true, codeCovTokenSecret: 'CODECOV_TOKEN', From 9acb85433f6f01c5070d41dc9ac618ab28056bab Mon Sep 17 00:00:00 2001 From: Dinesh Sajwan Date: Fri, 21 Jun 2024 15:41:19 -0400 Subject: [PATCH 2/7] feat(dotNetLib): added release trigger Co-authored-by: Scott Schreckengaust Signed-off-by: Dinesh Sajwan --- .projenrc.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/.projenrc.ts b/.projenrc.ts index 28ecbf4d..ff28eee6 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -14,7 +14,6 @@ import { ProjenStruct, Struct } from '@mrgrain/jsii-struct-builder'; import { JsonPatch, awscdk } from 'projen'; import { DependabotScheduleInterval, VersioningStrategy } from 'projen/lib/github'; import { NpmAccess } from 'projen/lib/javascript'; -import { ReleaseTrigger } from 'projen/lib/release'; import { buildUpgradeMainPRCustomJob } from './projenrc/github-jobs'; import { buildMeritBadgerWorkflow, From 79d6514c071fd0e8e609531884b38d956d3e1ec8 Mon Sep 17 00:00:00 2001 From: Scott Schreckengaust Date: Fri, 21 Jun 2024 13:49:09 -0700 Subject: [PATCH 3/7] fix: namespace for NuGet package --- .gitattributes | 1 - .github/workflows/build.yml | 28 +++++++ .github/workflows/release.yml | 149 ---------------------------------- .gitignore | 1 - .mergify.yml | 2 + .projen/files.json | 1 - .projen/tasks.json | 37 +++++++++ .projenrc.ts | 9 +- package.json | 6 ++ 9 files changed, 80 insertions(+), 154 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.gitattributes b/.gitattributes index 8282f19b..6372c343 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14,7 +14,6 @@ /.github/workflows/monthly-repo-metrics.yml linguist-generated /.github/workflows/ort-toolkit.yml linguist-generated /.github/workflows/pull-request-lint.yml linguist-generated -/.github/workflows/release.yml linguist-generated /.github/workflows/semgrep.yml linguist-generated /.github/workflows/stale.yml linguist-generated /.github/workflows/upgrade-main.yml linguist-generated diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 271fbdc4..1dcbcfb6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -141,3 +141,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@60edb5dd545a775178f52524783378180af0d1f8 + with: + node-version: 20.x + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: 3.x + - 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 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 deleted file mode 100644 index 18124c0b..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,149 +0,0 @@ -# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen". - -name: release -on: - push: - branches: - - main - workflow_dispatch: {} -jobs: - release: - runs-on: ubuntu-latest - permissions: - contents: write - outputs: - latest_commit: ${{ steps.git_remote.outputs.latest_commit }} - env: - CI: "true" - steps: - - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - with: - fetch-depth: 0 - - name: Set git identity - run: |- - git config user.name "github-actions" - git config user.email "github-actions@github.com" - - name: Setup Node.js - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 - with: - node-version: 20.x - - name: Install dependencies - run: yarn install --check-files --frozen-lockfile - - name: release - run: npx projen release - - name: Upload coverage to Codecov - uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed - with: - token: ${{ secrets.CODECOV_TOKEN }} - directory: coverage - - name: Check for new commits - id: git_remote - run: echo "latest_commit=$(git ls-remote origin -h ${{ github.ref }} | cut -f1)" >> $GITHUB_OUTPUT - - name: Backup artifact permissions - if: ${{ steps.git_remote.outputs.latest_commit == github.sha }} - run: cd dist && getfacl -R . > permissions-backup.acl - continue-on-error: true - - name: Upload artifact - if: ${{ steps.git_remote.outputs.latest_commit == github.sha }} - uses: actions/upload-artifact@18bf333cd2249fbbbdb605fd9d9ed57efd7adf34 - with: - name: build-artifact - path: dist - release_github: - name: Publish to GitHub Releases - needs: release - runs-on: ubuntu-latest - permissions: - contents: write - if: needs.release.outputs.latest_commit == github.sha - steps: - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 - with: - node-version: 20.x - - 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: Collect GitHub Metadata - run: mv .repo/dist dist - - name: Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_REPOSITORY: ${{ github.repository }} - GITHUB_REF: ${{ github.ref }} - run: errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q "Release.tag_name already exists" $errout; then cat $errout; exit $exitcode; fi - release_npm: - name: Publish to npm - needs: release - runs-on: ubuntu-latest - permissions: - contents: read - if: needs.release.outputs.latest_commit == github.sha - steps: - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 - with: - node-version: 20.x - - 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 js artifact - run: cd .repo && npx projen package:js - - name: Collect js Artifact - run: mv .repo/dist dist - - name: Release - env: - NPM_DIST_TAG: latest - NPM_REGISTRY: registry.npmjs.org - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: npx -p publib@latest publib-npm - 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@60edb5dd545a775178f52524783378180af0d1f8 - with: - node-version: 20.x - - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d - with: - python-version: 3.x - - 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 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/.gitignore b/.gitignore index 56b4a4cb..58f4ce23 100644 --- a/.gitignore +++ b/.gitignore @@ -44,7 +44,6 @@ junit.xml !/.github/workflows/build.yml /dist/changelog.md /dist/version.txt -!/.github/workflows/release.yml !/.mergify.yml !/.github/workflows/upgrade-main.yml !/.github/pull_request_template.md diff --git a/.mergify.yml b/.mergify.yml index 299617cc..b4e099da 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -9,6 +9,7 @@ queue_rules: - status-success=build - status-success=package-js - status-success=package-python + - status-success=package-dotnet pull_request_rules: - name: Automatic merge on approval and successful build actions: @@ -26,3 +27,4 @@ pull_request_rules: - status-success=build - status-success=package-js - status-success=package-python + - status-success=package-dotnet diff --git a/.projen/files.json b/.projen/files.json index ecac832f..7dfe2490 100644 --- a/.projen/files.json +++ b/.projen/files.json @@ -13,7 +13,6 @@ ".github/workflows/monthly-repo-metrics.yml", ".github/workflows/ort-toolkit.yml", ".github/workflows/pull-request-lint.yml", - ".github/workflows/release.yml", ".github/workflows/semgrep.yml", ".github/workflows/stale.yml", ".github/workflows/upgrade-main.yml", diff --git a/.projen/tasks.json b/.projen/tasks.json index 0501abbc..a0550b96 100644 --- a/.projen/tasks.json +++ b/.projen/tasks.json @@ -181,6 +181,18 @@ }, { "spawn": "package:python" + }, + { + "spawn": "package:dotnet" + } + ] + }, + "package:dotnet": { + "name": "package:dotnet", + "description": "Create dotnet language bindings", + "steps": [ + { + "exec": "jsii-pacmak -v --target dotnet" } ] }, @@ -219,6 +231,28 @@ "name": "pre-compile", "description": "Prepare the project for compilation" }, + "publish:git": { + "name": "publish:git", + "description": "Prepends the release changelog onto the project changelog, creates a release commit, and tags the release", + "env": { + "CHANGELOG": "dist/changelog.md", + "RELEASE_TAG_FILE": "dist/releasetag.txt", + "PROJECT_CHANGELOG_FILE": "CHANGELOG.md", + "VERSION_FILE": "dist/version.txt" + }, + "steps": [ + { + "builtin": "release/update-changelog" + }, + { + "builtin": "release/tag-version" + }, + { + "exec": "git push --follow-tags origin main" + } + ], + "condition": "! git log --oneline -1 | grep -q \"chore(release):\"" + }, "release": { "name": "release", "description": "Prepare a release from \"main\" branch", @@ -240,6 +274,9 @@ }, { "exec": "git diff --ignore-space-at-eol --exit-code" + }, + { + "spawn": "publish:git" } ] }, diff --git a/.projenrc.ts b/.projenrc.ts index ff28eee6..98fb55b3 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -32,6 +32,11 @@ const PUBLICATION_NAMESPACE = 'cdklabs'; const PROJECT_NAME = 'generative-ai-cdk-constructs'; const CDK_VERSION: string = '2.143.0'; +function camelCaseIt(input: string): string { + // Hypens and dashes to spaces and then CamelCase... + return input.replace(/-/g, ' ').replace(/_/g, ' ').replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function(match, _) { if (+match === 0) return ""; return match.toUpperCase(); }); +} + const project = new awscdk.AwsCdkConstructLibrary({ author: 'Amazon Web Services - Prototyping and Cloud Engineering', authorAddress: 'https://aws.amazon.com', @@ -84,8 +89,8 @@ const project = new awscdk.AwsCdkConstructLibrary({ }, publishToNuget: { - dotNetNamespace: PUBLICATION_NAMESPACE+'.'+PROJECT_NAME.replace(/-/g, '_'), - packageId: PUBLICATION_NAMESPACE+'.'+PROJECT_NAME.replace(/-/g, '_'), + dotNetNamespace: camelCaseIt(PUBLICATION_NAMESPACE)+'.'+camelCaseIt(PROJECT_NAME), + packageId: camelCaseIt(PUBLICATION_NAMESPACE)+'.'+camelCaseIt(PROJECT_NAME), }, codeCov: true, diff --git a/package.json b/package.json index 426b4955..fcb0ca80 100644 --- a/package.json +++ b/package.json @@ -17,11 +17,13 @@ "generate-models-containers": "npx projen generate-models-containers", "package": "npx projen package", "package-all": "npx projen package-all", + "package:dotnet": "npx projen package:dotnet", "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", + "publish:git": "npx projen publish:git", "release": "npx projen release", "test": "npx projen test", "test:watch": "npx projen test:watch", @@ -148,6 +150,10 @@ "python": { "distName": "cdklabs.generative-ai-cdk-constructs", "module": "cdklabs.generative_ai_cdk_constructs" + }, + "dotnet": { + "namespace": "Cdklabs.GenerativeAiCdkConstructs", + "packageId": "Cdklabs.GenerativeAiCdkConstructs" } }, "tsc": { From 9525f07f7bf76e08231bfeae130fae5a2cc01f46 Mon Sep 17 00:00:00 2001 From: Scott Schreckengaust Date: Fri, 21 Jun 2024 14:08:47 -0700 Subject: [PATCH 4/7] fix: updates --- .gitattributes | 1 + .gitignore | 1 + .projen/files.json | 1 + .projen/tasks.json | 25 ------------------------- .projenrc.ts | 3 --- package.json | 1 - 6 files changed, 3 insertions(+), 29 deletions(-) diff --git a/.gitattributes b/.gitattributes index 6372c343..8282f19b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14,6 +14,7 @@ /.github/workflows/monthly-repo-metrics.yml linguist-generated /.github/workflows/ort-toolkit.yml linguist-generated /.github/workflows/pull-request-lint.yml linguist-generated +/.github/workflows/release.yml linguist-generated /.github/workflows/semgrep.yml linguist-generated /.github/workflows/stale.yml linguist-generated /.github/workflows/upgrade-main.yml linguist-generated diff --git a/.gitignore b/.gitignore index 58f4ce23..56b4a4cb 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ junit.xml !/.github/workflows/build.yml /dist/changelog.md /dist/version.txt +!/.github/workflows/release.yml !/.mergify.yml !/.github/workflows/upgrade-main.yml !/.github/pull_request_template.md diff --git a/.projen/files.json b/.projen/files.json index 7dfe2490..ecac832f 100644 --- a/.projen/files.json +++ b/.projen/files.json @@ -13,6 +13,7 @@ ".github/workflows/monthly-repo-metrics.yml", ".github/workflows/ort-toolkit.yml", ".github/workflows/pull-request-lint.yml", + ".github/workflows/release.yml", ".github/workflows/semgrep.yml", ".github/workflows/stale.yml", ".github/workflows/upgrade-main.yml", diff --git a/.projen/tasks.json b/.projen/tasks.json index a0550b96..b67f293c 100644 --- a/.projen/tasks.json +++ b/.projen/tasks.json @@ -231,28 +231,6 @@ "name": "pre-compile", "description": "Prepare the project for compilation" }, - "publish:git": { - "name": "publish:git", - "description": "Prepends the release changelog onto the project changelog, creates a release commit, and tags the release", - "env": { - "CHANGELOG": "dist/changelog.md", - "RELEASE_TAG_FILE": "dist/releasetag.txt", - "PROJECT_CHANGELOG_FILE": "CHANGELOG.md", - "VERSION_FILE": "dist/version.txt" - }, - "steps": [ - { - "builtin": "release/update-changelog" - }, - { - "builtin": "release/tag-version" - }, - { - "exec": "git push --follow-tags origin main" - } - ], - "condition": "! git log --oneline -1 | grep -q \"chore(release):\"" - }, "release": { "name": "release", "description": "Prepare a release from \"main\" branch", @@ -274,9 +252,6 @@ }, { "exec": "git diff --ignore-space-at-eol --exit-code" - }, - { - "spawn": "publish:git" } ] }, diff --git a/.projenrc.ts b/.projenrc.ts index 98fb55b3..be5693ff 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -79,9 +79,6 @@ const project = new awscdk.AwsCdkConstructLibrary({ npmTokenSecret: 'NPM_TOKEN', npmAccess: NpmAccess.PUBLIC, - // Manual release, remove once NuGet Account is activated - releaseTrigger: ReleaseTrigger.manual(), - publishToPypi: { distName: PUBLICATION_NAMESPACE+'.'+PROJECT_NAME, module: (PUBLICATION_NAMESPACE.replace(/-/g, '_'))+'.'+(PROJECT_NAME.replace(/-/g, '_')), // PEP 8, convert hypens diff --git a/package.json b/package.json index fcb0ca80..a0e06793 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,6 @@ "post-compile": "npx projen post-compile", "post-upgrade": "npx projen post-upgrade", "pre-compile": "npx projen pre-compile", - "publish:git": "npx projen publish:git", "release": "npx projen release", "test": "npx projen test", "test:watch": "npx projen test:watch", From 9d983058b4bb00d029b321f54b70183d56190ab9 Mon Sep 17 00:00:00 2001 From: Scott Schreckengaust Date: Fri, 21 Jun 2024 14:09:41 -0700 Subject: [PATCH 5/7] fix: add missing release --- .github/workflows/release.yml | 183 ++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..02792646 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,183 @@ +# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen". + +name: release +on: + push: + branches: + - main + workflow_dispatch: {} +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: write + outputs: + latest_commit: ${{ steps.git_remote.outputs.latest_commit }} + env: + CI: "true" + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + with: + fetch-depth: 0 + - name: Set git identity + run: |- + git config user.name "github-actions" + git config user.email "github-actions@github.com" + - name: Setup Node.js + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 + with: + node-version: 20.x + - name: Install dependencies + run: yarn install --check-files --frozen-lockfile + - name: release + run: npx projen release + - name: Upload coverage to Codecov + uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed + with: + token: ${{ secrets.CODECOV_TOKEN }} + directory: coverage + - name: Check for new commits + id: git_remote + run: echo "latest_commit=$(git ls-remote origin -h ${{ github.ref }} | cut -f1)" >> $GITHUB_OUTPUT + - name: Backup artifact permissions + if: ${{ steps.git_remote.outputs.latest_commit == github.sha }} + run: cd dist && getfacl -R . > permissions-backup.acl + continue-on-error: true + - name: Upload artifact + if: ${{ steps.git_remote.outputs.latest_commit == github.sha }} + uses: actions/upload-artifact@18bf333cd2249fbbbdb605fd9d9ed57efd7adf34 + with: + name: build-artifact + path: dist + release_github: + name: Publish to GitHub Releases + needs: release + runs-on: ubuntu-latest + permissions: + contents: write + if: needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 + with: + node-version: 20.x + - 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: Collect GitHub Metadata + run: mv .repo/dist dist + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REPOSITORY: ${{ github.repository }} + GITHUB_REF: ${{ github.ref }} + run: errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q "Release.tag_name already exists" $errout; then cat $errout; exit $exitcode; fi + release_npm: + name: Publish to npm + needs: release + runs-on: ubuntu-latest + permissions: + contents: read + if: needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 + with: + node-version: 20.x + - 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 js artifact + run: cd .repo && npx projen package:js + - name: Collect js Artifact + run: mv .repo/dist dist + - name: Release + env: + NPM_DIST_TAG: latest + NPM_REGISTRY: registry.npmjs.org + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npx -p publib@latest publib-npm + 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@60edb5dd545a775178f52524783378180af0d1f8 + with: + node-version: 20.x + - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d + with: + python-version: 3.x + - 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 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.latest_commit == github.sha + steps: + - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 + with: + node-version: 20.x + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: 3.x + - 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 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 From 937260b5693722429da840f856007497005ad2f7 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 21 Jun 2024 21:13:54 +0000 Subject: [PATCH 6/7] chore: self mutation Signed-off-by: github-actions --- .projenrc.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.projenrc.ts b/.projenrc.ts index be5693ff..bd2da3bd 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -34,7 +34,7 @@ const CDK_VERSION: string = '2.143.0'; function camelCaseIt(input: string): string { // Hypens and dashes to spaces and then CamelCase... - return input.replace(/-/g, ' ').replace(/_/g, ' ').replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function(match, _) { if (+match === 0) return ""; return match.toUpperCase(); }); + return input.replace(/-/g, ' ').replace(/_/g, ' ').replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function(match, _) { if (+match === 0) return ''; return match.toUpperCase(); }); } const project = new awscdk.AwsCdkConstructLibrary({ From 4cc87aac1d2cb5d984ff82ee6259b592b3e56d5e Mon Sep 17 00:00:00 2001 From: Scott Schreckengaust Date: Mon, 24 Jun 2024 09:25:02 -0700 Subject: [PATCH 7/7] fix: specific commit for actions --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- .projenrc.ts | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1dcbcfb6..f304bba3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -150,7 +150,7 @@ jobs: - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 with: node-version: 20.x - - uses: actions/setup-dotnet@v3 + - uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 with: dotnet-version: 3.x - name: Download build artifacts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 02792646..98f227df 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -158,7 +158,7 @@ jobs: - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 with: node-version: 20.x - - uses: actions/setup-dotnet@v3 + - uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 with: dotnet-version: 3.x - name: Download build artifacts diff --git a/.projenrc.ts b/.projenrc.ts index bd2da3bd..c1cd6fe4 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -148,6 +148,8 @@ project.github?.actions.set('actions/checkout@v4', 'actions/checkout@b4ffde65f46 project.github?.actions.set('actions/download-artifact@v3', 'actions/download-artifact@b4aefff88e83a2676a730654e1ce3dce61880379'); // https://github.com/projen/projen/issues/3529 project.github?.actions.set('actions/download-artifact@v4', 'actions/download-artifact@b4aefff88e83a2676a730654e1ce3dce61880379'); 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-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