diff --git a/scripts/publish-on-tag.js b/scripts/publish-on-tag.js index eb23b6e3..6df7d759 100644 --- a/scripts/publish-on-tag.js +++ b/scripts/publish-on-tag.js @@ -9,13 +9,13 @@ import { fatal, log, RED, YELLOW } from './log.js'; /** * A tagged commit in this repo is created using the following format: * - * + * v * * where is the semantic version (SemVer) of the package. * * The following tag would satisfy the format: * - * 1.2.3-alpha + * v1.2.3-alpha */ const assertGitTag = () => { if (!GIT_TAG) { @@ -23,8 +23,10 @@ const assertGitTag = () => { return null; } + // Remove the 'v' prefix and assert that it's a valid SemVer version + const tag = GIT_TAG.replace(/^v/, ''); const semverRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/gm; - if (!semverRegex.test(GIT_TAG)) { + if (!semverRegex.test(tag)) { log(RED, `Aborting deployment to GitHub Releases because "${GIT_TAG}" does not conform to SemVer`); }