Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
FantasticFiasco committed Oct 17, 2023
1 parent fdd4160 commit e694f9a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/publish-on-tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,24 @@ import { fatal, log, RED, YELLOW } from './log.js';
/**
* A tagged commit in this repo is created using the following format:
*
* <version>
* v<version>
*
* where <version> 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) {
log(YELLOW, 'Skipping a deployment to GitHub Releases because this is not a tagged commit');
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`);
}

Expand Down

0 comments on commit e694f9a

Please sign in to comment.