Skip to content

Commit

Permalink
fix(version): create release when using custom tag-version-separator
Browse files Browse the repository at this point in the history
  • Loading branch information
briananstett committed Mar 21, 2024
1 parent 0cbf857 commit c700991
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion libs/commands/version/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,8 @@ class VersionCommand extends Command {
createRelease(
this.releaseClient,
{ tags: this.tags, releaseNotes: this.releaseNotes },
{ gitRemote: this.options.gitRemote, execOpts: this.execOpts }
{ gitRemote: this.options.gitRemote, execOpts: this.execOpts },
this.options.tagVersionSeparator || '@'
)
);
} else {
Expand Down
7 changes: 4 additions & 3 deletions libs/commands/version/src/lib/create-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,21 @@ export function createReleaseClient(type: "github" | "gitlab") {
export function createRelease(
client: ReturnType<typeof createReleaseClient>,
{ tags, releaseNotes }: { tags: string[]; releaseNotes: { name: string; notes: string }[] },
{ gitRemote, execOpts }: { gitRemote: string; execOpts: ExecOptions }
{ gitRemote, execOpts }: { gitRemote: string; execOpts: ExecOptions },
separator: string
) {
const repo = parseGitRepo(gitRemote, execOpts);

return Promise.all(
releaseNotes.map(({ notes, name }) => {
const tag = name === "fixed" ? tags[0] : tags.find((t) => t.startsWith(`${name}@`));
const tag = name === "fixed" ? tags[0] : tags.find((t) => t.startsWith(`${name}${separator}`));

/* istanbul ignore if */
if (!tag) {
return Promise.resolve();
}

const prereleaseParts = semver.prerelease(tag.replace(`${name}@`, "")) || [];
const prereleaseParts = semver.prerelease(tag.replace(`${name}${separator}`, "")) || [];

return client.repos.createRelease({
owner: repo.owner,
Expand Down

0 comments on commit c700991

Please sign in to comment.