tags are hard

This commit is contained in:
Brendan Forster 2018-02-04 10:49:28 +11:00
parent d0c5be50cb
commit b39015ac97

View file

@ -53,16 +53,15 @@ export async function run(args: ReadonlyArray<string>): Promise<void> {
)
} else if (channel === 'beta') {
const latestVersion = await getLatestRelease(false)
const isBetaRelease = latestVersion.indexOf('-beta') > -1
if (isBetaRelease) {
const betaNumber = latestVersion.substr(latestVersion.length - 2)
const betaTagIndex = latestVersion.indexOf('-beta')
if (betaTagIndex > -1) {
const betaNumber = latestVersion.substr(betaTagIndex + 5)
const newBeta = parseInt(betaNumber, 10) + 1
throw new Error(
`Drafting a beta release from ${latestVersion} which will be a new beta ${newBeta}`
)
} else {
const betaNumber = latestVersion.substr(latestVersion.length - 2)
const newBeta = parseInt(betaNumber, 10) + 1
const newBeta = 1
throw new Error(
`Drafting a beta release from ${latestVersion} which will be the first beta ${newBeta}`
)