also set version on current opened branch

This commit is contained in:
phips28 2019-10-27 20:07:29 +01:00
parent 6afa36b1fd
commit 37a6004763
2 changed files with 14 additions and 1 deletions

View File

@ -15,6 +15,8 @@ jobs:
uses: "actions/checkout@v1"
with:
ref: ${{ github.ref }}
- name: "cat package.json"
run: cat ./package.json
- name: "Setup Node.js"
uses: "actions/setup-node@v1"
with:
@ -23,3 +25,5 @@ jobs:
uses: "phips28/gh-action-bump-version@master"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "cat package.json"
run: cat ./package.json

View File

@ -30,11 +30,20 @@ Toolkit.run(async tools => {
const currentBranch = /refs\/[a-zA-Z]+\/(.*)/.exec(process.env.GITHUB_REF)[1]
console.log('currentBranch:', currentBranch)
await tools.runInWorkspace('npm',
['version', '--allow-same-version=true', '--git-tag-version=false', current])
console.log('current:', current, '/', 'version:', version)
let newVersion = execSync(`npm version --git-tag-version=false ${version}`).toString().trim()
await tools.runInWorkspace('git', ['commit', '-a', '-m', `"ci: ${commitMessage} ${newVersion}"`])
await tools.runInWorkspace('git', ['checkout', currentBranch])
await tools.runInWorkspace('npm',
['version', '--allow-same-version=true', '--git-tag-version=false', current])
console.log('current:', current, '/', 'version:', version)
const newVersion = execSync(`npm version --git-tag-version=false ${version}`).toString().trim()
newVersion = execSync(`npm version --git-tag-version=false ${version}`).toString().trim()
console.log('new version:', newVersion)
await tools.runInWorkspace('git', ['commit', '-a', '-m', `"ci: ${commitMessage} ${newVersion}"`])