Added npm tagging to deploy.mjs
This commit is contained in:
parent
c666e69807
commit
c8f423d43f
1 changed files with 18 additions and 9 deletions
|
@ -91,14 +91,22 @@ const packagesWhoseVersionsShouldBump = [
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
const allPackages = keyBy(
|
let npmTag = 'latest'
|
||||||
(await $`yarn workspaces list --json`)
|
if (version.match(/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/)) {
|
||||||
.toString()
|
console.log('npm tag: latest')
|
||||||
.split('\n')
|
} else {
|
||||||
.filter((s) => s.trim().length > 0)
|
const matches = version.match(
|
||||||
.map((s) => JSON.parse(s)),
|
/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\-(dev|rc|beta)\.[0-9]{1,3}$/,
|
||||||
'name',
|
|
||||||
)
|
)
|
||||||
|
if (!matches) {
|
||||||
|
console.log(
|
||||||
|
'Invalid version. Currently xx.xx.xx or xx.xx.xx-(dev|rc|beta).xx is allowed',
|
||||||
|
)
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
const npmTag = matches[1]
|
||||||
|
console.log('npm tag: ' + npmTag)
|
||||||
|
}
|
||||||
|
|
||||||
if ((await $`git status -s`).toString().length > 0) {
|
if ((await $`git status -s`).toString().length > 0) {
|
||||||
console.error(`Git working directory contains uncommitted changes:`)
|
console.error(`Git working directory contains uncommitted changes:`)
|
||||||
|
@ -169,7 +177,8 @@ const packagesWhoseVersionsShouldBump = [
|
||||||
console.log('Publishing to npm')
|
console.log('Publishing to npm')
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
packagesToPublish.map(
|
packagesToPublish.map(
|
||||||
(workspace) => $`yarn workspace ${workspace} npm publish --access public`,
|
(workspace) =>
|
||||||
|
$`yarn workspace ${workspace} npm publish --access public --tag ${npmTag}`,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
})()
|
})()
|
||||||
|
|
Loading…
Reference in a new issue