Skip to content

Commit

Permalink
fix(bump): Fix detection of version scheme for test builds (#12758)
Browse files Browse the repository at this point in the history
Test builds have a version set in CI of the form `0.0.0-12345-test`,
where `12345` is the CI build number. The bump command was parsing the
version scheme from the original version of the package and didn't
update it with the final new version after processing all the command
arguments.
  • Loading branch information
tylerbutler authored Nov 2, 2022
1 parent 9b7f2b4 commit 00f660b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions build-tools/packages/build-cli/src/commands/bump.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,13 @@ export default class BumpCommand extends BaseCommand<typeof BumpCommand.flags> {
bumpArg = bumpType;
}

// Update the scheme based on the new version, unless it was passed in explicitly
scheme = flags.scheme ?? detectVersionScheme(newVersion);

this.logHr();
this.log(`Release group: ${chalk.blueBright(args.package_or_release_group)}`);
this.log(`Bump type: ${chalk.blue(bumpType ?? "exact")}`);
this.log(`Scheme: ${chalk.cyan(scheme)}`);
this.log(`Versions: ${newVersion} <== ${repoVersion}`);
this.log(`Install: ${shouldInstall ? chalk.green("yes") : "no"}`);
this.log(`Commit: ${shouldCommit ? chalk.green("yes") : "no"}`);
Expand Down
6 changes: 6 additions & 0 deletions build-tools/packages/version-tools/src/test/schemes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ describe("detectVersionScheme", () => {
assert.strictEqual(detectVersionScheme(input), expected);
});

it("detects 0.0.0-105091-test is semver", () => {
const input = `0.0.0-105091-test`;
const expected = "semver";
assert.strictEqual(detectVersionScheme(input), expected);
});

it("detects 2.4.3 is semver", () => {
const input = `2.4.3`;
const expected = "semver";
Expand Down

0 comments on commit 00f660b

Please sign in to comment.