diff --git a/ng-dev/release/publish/actions.ts b/ng-dev/release/publish/actions.ts index 60409d3a7..c3aa8deaa 100644 --- a/ng-dev/release/publish/actions.ts +++ b/ng-dev/release/publish/actions.ts @@ -136,6 +136,16 @@ export abstract class ReleaseAction { } } + /* + * Get the modified Aspect lock files if `rulesJsInteropMode` is enabled. + */ + protected getAspectLockFiles(): string[] { + // TODO: Remove after `rules_js` migration is complete. + return this.config.rulesJsInteropMode + ? glob.sync(['.aspect/**', 'pnpm-lock.yaml'], {cwd: this.projectDir}) + : []; + } + /** Gets the most recent commit of a specified branch. */ protected async getLatestCommitOfBranch(branchName: string): Promise { const { @@ -221,14 +231,11 @@ export abstract class ReleaseAction { // Commit message for the release point. const commitMessage = getCommitMessageForRelease(newVersion); - - const filesToCommit = [workspaceRelativePackageJsonPath, workspaceRelativeChangelogPath]; - - // Ensure modified Aspect lock files are included in the release commit. - // TODO: Remove after `rules_js` migration is complete. - if (this.config.rulesJsInteropMode) { - filesToCommit.push(...glob.sync(['.aspect/**', 'pnpm-lock.yaml'], {cwd: this.projectDir})); - } + const filesToCommit = [ + workspaceRelativePackageJsonPath, + workspaceRelativeChangelogPath, + ...this.getAspectLockFiles(), + ]; // Create a release staging commit including changelog and version bump. await this.createCommit(commitMessage, filesToCommit); diff --git a/ng-dev/release/publish/actions/configure-next-as-major.ts b/ng-dev/release/publish/actions/configure-next-as-major.ts index b2a0ff6e2..048920ac1 100644 --- a/ng-dev/release/publish/actions/configure-next-as-major.ts +++ b/ng-dev/release/publish/actions/configure-next-as-major.ts @@ -38,8 +38,10 @@ export class ConfigureNextAsMajorAction extends ReleaseAction { await this.assertPassingGithubStatus(beforeStagingSha, branchName); await this.checkoutUpstreamBranch(branchName); await this.updateProjectVersion(newVersion); + await this.createCommit(getCommitMessageForNextBranchMajorSwitch(newVersion), [ workspaceRelativePackageJsonPath, + ...this.getAspectLockFiles(), ]); const pullRequest = await this.pushChangesToForkAndCreatePullRequest( branchName, diff --git a/ng-dev/release/publish/actions/exceptional-minor/prepare-exceptional-minor.ts b/ng-dev/release/publish/actions/exceptional-minor/prepare-exceptional-minor.ts index 7a11eb2f7..78bd688ad 100644 --- a/ng-dev/release/publish/actions/exceptional-minor/prepare-exceptional-minor.ts +++ b/ng-dev/release/publish/actions/exceptional-minor/prepare-exceptional-minor.ts @@ -48,9 +48,12 @@ export class PrepareExceptionalMinorAction extends ReleaseAction { await this.updateProjectVersion(this._newVersion, (pkgJson) => { pkgJson[exceptionalMinorPackageIndicator] = true; }); + await this.createCommit(`build: prepare exceptional minor branch: ${this._newBranch}`, [ workspaceRelativePackageJsonPath, + ...this.getAspectLockFiles(), ]); + await this.pushHeadToRemoteBranch(this._newBranch); Log.info(green(` ✓ Version branch "${this._newBranch}" created.`)); diff --git a/ng-dev/release/publish/actions/shared/branch-off-next-branch.ts b/ng-dev/release/publish/actions/shared/branch-off-next-branch.ts index 44434bb03..87132e8c1 100644 --- a/ng-dev/release/publish/actions/shared/branch-off-next-branch.ts +++ b/ng-dev/release/publish/actions/shared/branch-off-next-branch.ts @@ -139,7 +139,10 @@ export abstract class BranchOffNextBranchBaseAction extends CutNpmNextPrerelease // Create an individual commit for the next version bump. The changelog should go into // a separate commit that makes it clear where the changelog is cherry-picked from. - await this.createCommit(bumpCommitMessage, [workspaceRelativePackageJsonPath]); + await this.createCommit(bumpCommitMessage, [ + workspaceRelativePackageJsonPath, + ...this.getAspectLockFiles(), + ]); await this.prependReleaseNotesToChangelog(releaseNotes);