Skip to content

Commit

Permalink
feat: release.js => generate version/tags
Browse files Browse the repository at this point in the history
  • Loading branch information
qiuweikangdev committed Oct 2, 2022
1 parent c535db1 commit 8be84cf
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions scripts/release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// generate version/tags

const { execSync } = require('child_process')
const pkg = require('../packages/echarts/package.json')
const { program } = require('commander')

program.option('-r, --release <version>', 'package version')
program.parse()

const { release } = program.opts()
const tag = `${pkg.name}-v${release}`
try {
if (release) {
const value = execSync(`git tag -l ${tag}`).toString('utf8')
if (!value) {
execSync(
`cd packages/echarts && standard-version -r ${release} -t ${pkg.name}-v --infile ../../CHANGELOG.md`,
)
execSync(`git push origin ${tag}`)
execSync(`git push origin HEAD`)
} else {
throw `${tag} already exists`
}
} else {
throw 'release does not exist'
}
} catch (e) {
console.log(e)
}

0 comments on commit 8be84cf

Please sign in to comment.