Skip to content

Commit 59c8c3f

Browse files
authored
chore: add corepack enable to JSII packaging publish jobs (#1379)
Fixes the release workflow failure where downstream per-package publish jobs (maven, pypi, nuget, golang) fail with: `error This project's package.json defines "packageManager": "yarn@4.13.0".` However the current global version of Yarn is 1.22.22. ### Problem The main `release` job has a `corepack enable` step (added automatically by Projen's `NodeProject` for Yarn Berry). However, the JSII packaging publish jobs are generated by custom code in `projenrc/jsii.ts`. The `pacmakForLanguage` method builds its own `bootstrapSteps` and handles pnpm and bun setup, but had no equivalent for Yarn Berry. When those jobs check out `.repo` and run `yarn install --immutable`, they hit the runner's global Yarn 1.x instead of the Corepack-managed Yarn 4.13.0. ### Fix Added a `corepack enable` bootstrap step for `YARN_BERRY` / `YARN2` package managers in `pacmakForLanguage()`, matching the existing pattern for pnpm and bun. After regeneration, `release.yml` now has `corepack enable` in all affected publish jobs. ### Checklist - [ ] This change contains a major version upgrade for a dependency and I confirm all breaking changes are addressed - Release notes for the new version: --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
1 parent 7176bba commit 59c8c3f

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

projenrc/jsii.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,13 @@ export class JsiiBuild extends pj.Component {
487487

488488
// Generic bootstrapping for all target languages
489489
bootstrapSteps.push(...(this.tsProject as any).workflowBootstrapSteps);
490-
if (this.tsProject.package.packageManager === NodePackageManager.PNPM) {
490+
if (this.tsProject.package.packageManager === NodePackageManager.YARN_BERRY
491+
|| this.tsProject.package.packageManager === NodePackageManager.YARN2) {
492+
bootstrapSteps.push({
493+
name: 'Enable corepack',
494+
run: 'corepack enable',
495+
});
496+
} else if (this.tsProject.package.packageManager === NodePackageManager.PNPM) {
491497
bootstrapSteps.push({
492498
name: 'Setup pnpm',
493499
uses: 'pnpm/action-setup@v3',

0 commit comments

Comments
 (0)