-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(docs): publish github pages (#5411)
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const semver = require('semver'); | ||
const getVersion = require('./get-version'); | ||
/** | ||
* Get the release tag for the current release | ||
* @param isHotfix {boolean} | ||
* @param isPrerelease {boolean} | ||
* @param currentVersion {string} | ||
* @returns {Promise<'latest' | 'hotfix' | 'prerelease'>} | ||
*/ | ||
module.exports = async (isHotfix, isPrerelease, currentVersion) => { | ||
const getTag = (isHotfixCheck, prereleaseCheck) => | ||
isHotfix && isHotfixCheck(currentVersion) | ||
? 'hotfix' | ||
: isPrerelease && prereleaseCheck | ||
? 'prerelease' | ||
: 'latest'; | ||
|
||
if (isHotfix && isPrerelease) { | ||
throw new Error('Cannot be both hotfix and a prerelease'); | ||
} | ||
|
||
const isHotfixMatch = async () => { | ||
const latestVersion = await getVersion('origin/main'); | ||
return !semver.lt(latestVersion, currentVersion); | ||
} | ||
|
||
return getTag(isHotfixMatch, () => true); | ||
}; |