use runInWorkspace
This commit is contained in:
parent
4db36ed50f
commit
c6eb09cd73
20
index.js
20
index.js
|
@ -25,27 +25,25 @@ Toolkit.run(async tools => {
|
||||||
version = 'minor'
|
version = 'minor'
|
||||||
}
|
}
|
||||||
|
|
||||||
const exec = str => {
|
|
||||||
return process.stdout.write(execSync(str))
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const current = pkg.version.toString()
|
const current = pkg.version.toString()
|
||||||
exec('git checkout master')
|
await tools.runInWorkspace('git', ['checkout', 'master'])
|
||||||
exec(`npm version --allow-same-version=true --git-tag-version=false ${current} `)
|
await tools.runInWorkspace('npm',
|
||||||
|
['version', '--allow-same-version=true', '--git-tag-version=false', current, 'master'])
|
||||||
console.log('current:', current, '/', 'version:', version)
|
console.log('current:', current, '/', 'version:', version)
|
||||||
const newVersion = execSync(`npm version --git-tag-version=false ${version}`).toString()
|
const newVersion = execSync(`npm version --git-tag-version=false ${version}`).toString()
|
||||||
console.log('new version:', newVersion)
|
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`
|
const remoteRepo = `https://${process.env.GITHUB_ACTOR}:${process.env.GITHUB_TOKEN}@github.com/${process.env.GITHUB_REPOSITORY}.git`
|
||||||
console.log('remoteRepo:', remoteRepo)
|
console.log('remoteRepo:', remoteRepo)
|
||||||
|
|
||||||
exec(`git tag ${newVersion}`)
|
await tools.runInWorkspace('git', ['tag', '-a', newVersion])
|
||||||
exec(`git push "${remoteRepo}" --follow-tags`)
|
await tools.runInWorkspace('git', ['push', `"${remoteRepo}"`, '--follow-tags'])
|
||||||
exec(`git push "${remoteRepo}" --tags`)
|
await tools.runInWorkspace('git', ['push', `"${remoteRepo}"`, '--tags'])
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
tools.exit.failure(`Failed: ${e.toString()}`)
|
tools.log.fatal(e)
|
||||||
|
tools.exit.failure('Failed to bump version')
|
||||||
}
|
}
|
||||||
tools.exit.success('Version bumped!')
|
tools.exit.success('Version bumped!')
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue