Skip to content

Commit 1037f97

Browse files
authored
fix(ng-dev): ensure release actions commit aspect lock files (#2539)
Several actions within the release process were not committing the aspect lock files as expected. This fix ensures that the aspect lock files are properly committed during all relevant stages of the release workflow.
1 parent 0b6f7cb commit 1037f97

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

ng-dev/release/publish/actions.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,16 @@ export abstract class ReleaseAction {
136136
}
137137
}
138138

139+
/*
140+
* Get the modified Aspect lock files if `rulesJsInteropMode` is enabled.
141+
*/
142+
protected getAspectLockFiles(): string[] {
143+
// TODO: Remove after `rules_js` migration is complete.
144+
return this.config.rulesJsInteropMode
145+
? glob.sync(['.aspect/**', 'pnpm-lock.yaml'], {cwd: this.projectDir})
146+
: [];
147+
}
148+
139149
/** Gets the most recent commit of a specified branch. */
140150
protected async getLatestCommitOfBranch(branchName: string): Promise<string> {
141151
const {
@@ -221,14 +231,11 @@ export abstract class ReleaseAction {
221231

222232
// Commit message for the release point.
223233
const commitMessage = getCommitMessageForRelease(newVersion);
224-
225-
const filesToCommit = [workspaceRelativePackageJsonPath, workspaceRelativeChangelogPath];
226-
227-
// Ensure modified Aspect lock files are included in the release commit.
228-
// TODO: Remove after `rules_js` migration is complete.
229-
if (this.config.rulesJsInteropMode) {
230-
filesToCommit.push(...glob.sync(['.aspect/**', 'pnpm-lock.yaml'], {cwd: this.projectDir}));
231-
}
234+
const filesToCommit = [
235+
workspaceRelativePackageJsonPath,
236+
workspaceRelativeChangelogPath,
237+
...this.getAspectLockFiles(),
238+
];
232239

233240
// Create a release staging commit including changelog and version bump.
234241
await this.createCommit(commitMessage, filesToCommit);

ng-dev/release/publish/actions/configure-next-as-major.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ export class ConfigureNextAsMajorAction extends ReleaseAction {
3838
await this.assertPassingGithubStatus(beforeStagingSha, branchName);
3939
await this.checkoutUpstreamBranch(branchName);
4040
await this.updateProjectVersion(newVersion);
41+
4142
await this.createCommit(getCommitMessageForNextBranchMajorSwitch(newVersion), [
4243
workspaceRelativePackageJsonPath,
44+
...this.getAspectLockFiles(),
4345
]);
4446
const pullRequest = await this.pushChangesToForkAndCreatePullRequest(
4547
branchName,

ng-dev/release/publish/actions/exceptional-minor/prepare-exceptional-minor.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,12 @@ export class PrepareExceptionalMinorAction extends ReleaseAction {
4848
await this.updateProjectVersion(this._newVersion, (pkgJson) => {
4949
pkgJson[exceptionalMinorPackageIndicator] = true;
5050
});
51+
5152
await this.createCommit(`build: prepare exceptional minor branch: ${this._newBranch}`, [
5253
workspaceRelativePackageJsonPath,
54+
...this.getAspectLockFiles(),
5355
]);
56+
5457
await this.pushHeadToRemoteBranch(this._newBranch);
5558

5659
Log.info(green(` ✓ Version branch "${this._newBranch}" created.`));

ng-dev/release/publish/actions/shared/branch-off-next-branch.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ export abstract class BranchOffNextBranchBaseAction extends CutNpmNextPrerelease
139139

140140
// Create an individual commit for the next version bump. The changelog should go into
141141
// a separate commit that makes it clear where the changelog is cherry-picked from.
142-
await this.createCommit(bumpCommitMessage, [workspaceRelativePackageJsonPath]);
142+
await this.createCommit(bumpCommitMessage, [
143+
workspaceRelativePackageJsonPath,
144+
...this.getAspectLockFiles(),
145+
]);
143146

144147
await this.prependReleaseNotesToChangelog(releaseNotes);
145148

0 commit comments

Comments
 (0)