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
ghiscoding committed Apr 2, 2024
1 parent c247658 commit 5fa6184
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/version/src/lib/create-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function createRelease(
generateReleaseNotes?: boolean;
releaseDiscussion?: string;
},
{ tags, releaseNotes }: ReleaseCommandProps,
{ tags, releaseNotes, tagVersionSeparator }: ReleaseCommandProps,
{ gitRemote, execOpts, skipBumpOnlyReleases }: ReleaseOptions,
dryRun = false
) {
Expand All @@ -41,15 +41,15 @@ export function createRelease(

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

// when using independent mode, it could happen that a few version bump only releases are created
// and since these aren't very useful for most users, user could choose to skip creating these releases when detecting a version bump only
if (!tag || (skipBumpOnlyReleases && pkg?.isBumpOnlyVersion)) {
return Promise.resolve();
}

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

// when the `GH_TOKEN` (or `GITHUB_TOKEN`) environment variable is not set,
// we'll create a link to GitHub web interface form with the fields pre-populated
Expand Down
1 change: 1 addition & 0 deletions packages/version/src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export interface ReleaseClient {

export interface ReleaseCommandProps {
tags: string[];
tagVersionSeparator: string;
releaseNotes: ReleaseNote[];
}

Expand Down
6 changes: 5 additions & 1 deletion packages/version/src/version-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,11 @@ export class VersionCommand extends Command<VersionCommandOption> {
generateReleaseNotes: this.options.generateReleaseNotes,
releaseDiscussion: this.options.createReleaseDiscussion,
},
{ tags: this.tags, releaseNotes: this.releaseNotes },
{
tags: this.tags,
tagVersionSeparator: this.options.tagVersionSeparator || '@',
releaseNotes: this.releaseNotes,
},
{
gitRemote: this.options.gitRemote,
execOpts: this.execOpts,
Expand Down

0 comments on commit 5fa6184

Please sign in to comment.