use runInWorkspace

This commit is contained in:
phips28 2019-10-26 21:26:43 +02:00
parent 4db36ed50f
commit c6eb09cd73
1 changed files with 9 additions and 11 deletions

View File

@ -25,27 +25,25 @@ Toolkit.run(async tools => {
version = 'minor'
}
const exec = str => {
return process.stdout.write(execSync(str))
}
try {
const current = pkg.version.toString()
exec('git checkout master')
exec(`npm version --allow-same-version=true --git-tag-version=false ${current} `)
await tools.runInWorkspace('git', ['checkout', 'master'])
await tools.runInWorkspace('npm',
['version', '--allow-same-version=true', '--git-tag-version=false', current, 'master'])
console.log('current:', current, '/', 'version:', version)
const newVersion = execSync(`npm version --git-tag-version=false ${version}`).toString()
console.log('new version:', newVersion)
exec(`git commit -a -m 'ci: ${commitMessage} ${newVersion}'`)
await tools.runInWorkspace('git', ['commit', '-a', '-m', `'ci: ${commitMessage} ${newVersion}'`])
const remoteRepo = `https://${process.env.GITHUB_ACTOR}:${process.env.GITHUB_TOKEN}@github.com/${process.env.GITHUB_REPOSITORY}.git`
console.log('remoteRepo:', remoteRepo)
exec(`git tag ${newVersion}`)
exec(`git push "${remoteRepo}" --follow-tags`)
exec(`git push "${remoteRepo}" --tags`)
await tools.runInWorkspace('git', ['tag', '-a', newVersion])
await tools.runInWorkspace('git', ['push', `"${remoteRepo}"`, '--follow-tags'])
await tools.runInWorkspace('git', ['push', `"${remoteRepo}"`, '--tags'])
} catch (e) {
tools.exit.failure(`Failed: ${e.toString()}`)
tools.log.fatal(e)
tools.exit.failure('Failed to bump version')
}
tools.exit.success('Version bumped!')
})