Skip to content

Commit

Permalink
Merge pull request #1568 from intuit/git-tag-prefix-next
Browse files Browse the repository at this point in the history
fix `next` release prefixing in git-tag plugin
  • Loading branch information
hipstersmoothie authored Oct 6, 2020
2 parents ca6ecbe + aee60dd commit 624b2b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
12 changes: 6 additions & 6 deletions plugins/git-tag/__tests__/git-tag.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const setup = (mockGit?: any) => {
git: mockGit,
remote: "origin",
logger: dummyLog(),
prefixRelease: (r: string) => r,
prefixRelease: (r: string) => `v${r}`,
config: { prereleaseBranches: ["next"] },
getCurrentVersion: () => "v1.0.0",
} as unknown) as Auto.Auto);
Expand Down Expand Up @@ -55,7 +55,7 @@ describe("Git Tag Plugin", () => {
},
});
const previousVersion = await hooks.getPreviousVersion.promise();
expect(previousVersion).toBe("0.0.0");
expect(previousVersion).toBe("v0.0.0");
});
});

Expand All @@ -77,9 +77,9 @@ describe("Git Tag Plugin", () => {
await hooks.version.promise(Auto.SEMVER.patch);
expect(exec).toHaveBeenCalledWith("git", [
"tag",
"1.0.1",
"v1.0.1",
"-m",
'"Update version to 1.0.1"',
'"Update version to v1.0.1"',
]);
});
});
Expand All @@ -101,9 +101,9 @@ describe("Git Tag Plugin", () => {

expect(exec).toHaveBeenCalledWith("git", [
"tag",
"1.0.1-next.0",
"v1.0.1-next.0",
"-m",
'"Tag pre-release: 1.0.1-next.0"',
'"Tag pre-release: v1.0.1-next.0"',
]);
expect(exec).toHaveBeenCalledWith("git", [
"push",
Expand Down
7 changes: 2 additions & 5 deletions plugins/git-tag/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,8 @@ export default class GitTagPlugin implements IPlugin {
const current =
(await auto.git.getLastTagNotInBaseBranch(prereleaseBranch)) ||
(await auto.getCurrentVersion(lastRelease));
const prerelease = determineNextVersion(
lastRelease,
current,
bump,
prereleaseBranch
const prerelease = auto.prefixRelease(
determineNextVersion(lastRelease, current, bump, prereleaseBranch)
);

await execPromise("git", [
Expand Down

0 comments on commit 624b2b1

Please sign in to comment.