Skip to content

Commit

Permalink
build: update projen version as part of upgrade workflow (#695)
Browse files Browse the repository at this point in the history
Adds a task to run as part of the upgrade-mainline workflow which updates the projen version such that PDK and its vended projects all depend on the same projen version.
  • Loading branch information
cogwirrel authored Feb 1, 2024
1 parent 9eb60a6 commit a1a4909
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/upgrade-mainline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
ref: mainline
- name: PDK Init
uses: ./.github/actions/pdk-init
- name: Upgrade projen
run: pnpm nx run @aws/monorepo:upgrade-projen
- name: Upgrade dependencies
run: pnpm projen upgrade-deps
- name: Build
Expand Down
8 changes: 8 additions & 0 deletions packages/monorepo/.projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/monorepo/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions packages/monorepo/project.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions packages/monorepo/scripts/upgrade-projen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as ncu from "npm-check-updates";
import * as fs from "fs";
import * as path from "path";

(async () => {
// Get the latest minor version update of projen
const { projen } = await ncu.run({
jsonUpgraded: true,
target: "minor",
filter: "projen",
}) as any;

// Write the projen version to projen-version.ts
fs.writeFileSync(path.resolve(__dirname, "../src/components/projen-version.ts"), `export default "^${projen}";`);
})();
3 changes: 3 additions & 0 deletions projenrc/projects/monorepo-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export class MonorepoProject extends PDKProject {
// Don't check for a license header etc for projen-version.ts so this can be written via automation
this.eslint?.addIgnorePattern("src/components/projen-version.ts");

// Add a task to upgrade the projen version. Ideally run before upgrade-deps in the root.
this.addTask("upgrade-projen").exec("ts-node ./scripts/upgrade-projen.ts")

this.generateInterfaces();
}

Expand Down

0 comments on commit a1a4909

Please sign in to comment.