Skip to content

Commit 1c7f5d3

Browse files
committed
workflow: auto determine release dist-tag
1 parent 4b595a3 commit 1c7f5d3

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

scripts/release.js

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,14 @@ async function main() {
4949
})
5050

5151
if (release === 'custom') {
52-
targetVersion = (await prompt({
53-
type: 'input',
54-
name: 'version',
55-
message: 'Input custom version',
56-
initial: currentVersion
57-
})).version
52+
targetVersion = (
53+
await prompt({
54+
type: 'input',
55+
name: 'version',
56+
message: 'Input custom version',
57+
initial: currentVersion
58+
})
59+
).version
5860
} else {
5961
targetVersion = release.match(/\((.*)\)/)[1]
6062
}
@@ -181,9 +183,21 @@ async function publishPackage(pkgName, version, runIfNotDry) {
181183
return
182184
}
183185

184-
// for now (alpha/beta phase), every package except "vue" can be published as
186+
// For now, all 3.x packages except "vue" can be published as
185187
// `latest`, whereas "vue" will be published under the "next" tag.
186-
const releaseTag = args.tag || (pkgName === 'vue' ? 'next' : null)
188+
let releaseTag = null
189+
if (args.tag) {
190+
releaseTag = args.tag
191+
} else if (version.includes('alpha')) {
192+
releaseTag = 'alpha'
193+
} else if (version.includes('beta')) {
194+
releaseTag = 'beta'
195+
} else if (version.includes('rc')) {
196+
releaseTag = 'rc'
197+
} else if (pkgName === 'vue') {
198+
// TODO remove when 3.x becomes default
199+
releaseTag = 'next'
200+
}
187201

188202
// TODO use inferred release channel after official 3.0 release
189203
// const releaseTag = semver.prerelease(version)[0] || null

0 commit comments

Comments
 (0)