Skip to content

Commit

Permalink
chore: make sure the tag we're using is a version
Browse files Browse the repository at this point in the history
  • Loading branch information
benlesh committed Jan 12, 2024
1 parent 1fc1788 commit b733f3a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ if (!Object.values(DIST_TAGS).includes('latest')) {

// Publishing was triggered via an GitHub release being created (almost certainly via our `yarn release` script)
if (process.env.GITHUB_EVENT_NAME === 'release') {
const tag = process.env.GITHUB_REF;
let tag = process.env.GITHUB_REF;
if (!tag) {
throw new Error('No tag found in environment variable GITHUB_REF');
}
if (!valid(tag) && /^refs\/tags\//.test(tag)) {
// It might be a full ref tag name instead of just a version, so try to get the version from the tag
tag = tag.split('/').pop();
}
if (!valid(tag)) {
throw new Error(`Git tag '${tag}' pulled from environment variable GITHUB_REF is not a valid semver version`);
}
Expand Down

0 comments on commit b733f3a

Please sign in to comment.