Skip to content

Update release script to use prerelease versions#3845

Merged
ntotten merged 1 commit intomainfrom
update_release_script
Nov 28, 2025
Merged

Update release script to use prerelease versions#3845
ntotten merged 1 commit intomainfrom
update_release_script

Conversation

@ntotten
Copy link
Member

@ntotten ntotten commented Nov 28, 2025

No description provided.

Copilot AI review requested due to automatic review settings November 28, 2025 20:14
@ntotten ntotten merged commit 7f750a0 into main Nov 28, 2025
14 checks passed
@ntotten ntotten deleted the update_release_script branch November 28, 2025 20:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the release script to replace the "preview" release type with a more flexible prerelease system using a --pre flag. Instead of embedding prerelease identifiers in the version string (e.g., 11.0.0-preview.1), the new approach stores clean semantic versions in package.json (e.g., 11.0.1) and appends -pre to git tags only (e.g., v11.0.1-pre).

Key changes:

  • Replaced preview release type with --pre flag that works with any release type (major/minor/patch)
  • Simplified version parsing to only accept X.Y.Z format, removing prerelease version logic
  • Manual versions can now be used with any release type, not just previews

console.error(
" pnpm release patch --pre - 11.0.0 -> 11.0.1 (tag: v11.0.1-pre)",
);
console.error(" pnpm release minor 12.1.0 - Use specific version");
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example suggests that any release type can be used with a manual version (pnpm release minor 12.1.0), but the validation at line 128-136 doesn't enforce that the manual version is consistent with the release type. For example, pnpm release patch 13.0.0 would be accepted even though 13.0.0 represents a major version bump. Consider adding validation to ensure the manual version is semantically consistent with the specified release type, or clarify in the documentation that the release type is ignored when a manual version is provided.

Copilot uses AI. Check for mistakes.
* pnpm release major - Bump major version (11.0.0 -> 12.0.0)
* pnpm release minor - Bump minor version (11.0.0 -> 11.1.0)
* pnpm release patch - Bump patch version (11.0.0 -> 11.0.1)
* pnpm release patch --pre - Patch as prerelease (tag: v11.0.1-pre)
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation states "Patch as prerelease" but the behavior actually bumps the patch version before applying the prerelease tag. If the current version is 11.0.0, running pnpm release patch --pre will result in version 11.0.1 with tag v11.0.1-pre, not 11.0.0-pre. Consider clarifying this as "Bump patch and mark as prerelease" or "Patch bump with prerelease tag" to avoid confusion.

Suggested change
* pnpm release patch --pre - Patch as prerelease (tag: v11.0.1-pre)
* pnpm release patch --pre - Bump patch and mark as prerelease (tag: v11.0.1-pre)

Copilot uses AI. Check for mistakes.
Comment on lines 27 to 37
function parseVersion(version) {
// Handle prerelease versions like "11.1.0-preview.1"
const match = version.match(/^(\d+)\.(\d+)\.(\d+)(?:-([a-z]+)\.(\d+))?$/i);
const match = version.match(/^(\d+)\.(\d+)\.(\d+)$/);
if (!match) {
throw new Error(`Invalid version format: ${version}`);
}
return {
major: parseInt(match[1], 10),
minor: parseInt(match[2], 10),
patch: parseInt(match[3], 10),
prerelease: match[4] || null,
prereleaseNum: match[5] ? parseInt(match[5], 10) : null,
};
}
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated parseVersion function only accepts semver versions in X.Y.Z format and will fail if the current package.json version contains a prerelease identifier from the old system (e.g., 11.0.1-preview.1). This could break the script during the transition period. Consider adding backward compatibility to handle the old prerelease format, or document that package.json must be manually updated to a clean semver version before using this new script version.

Copilot uses AI. Check for mistakes.
manualVersion || calculateNewVersion(currentVersion, releaseType);

console.log(`\nRelease: ${releaseType}`);
const tagName = isPrerelease ? `v${newVersion}-pre` : `v${newVersion}`;
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tag suffix -pre is not recognized by the GitHub workflow's prerelease detection logic. The workflow at .github/workflows/main.yaml:90 checks for -preview|-beta|-alpha|-rc patterns but not -pre. This means prereleases created with this script will be published as stable releases. Either update the workflow to include -pre in the regex pattern, or change this script to use -preview instead of -pre to maintain compatibility with the existing workflow.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants