also set version on current opened branch
This commit is contained in:
parent
6afa36b1fd
commit
37a6004763
|
@ -15,6 +15,8 @@ jobs:
|
||||||
uses: "actions/checkout@v1"
|
uses: "actions/checkout@v1"
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.ref }}
|
ref: ${{ github.ref }}
|
||||||
|
- name: "cat package.json"
|
||||||
|
run: cat ./package.json
|
||||||
- name: "Setup Node.js"
|
- name: "Setup Node.js"
|
||||||
uses: "actions/setup-node@v1"
|
uses: "actions/setup-node@v1"
|
||||||
with:
|
with:
|
||||||
|
@ -23,3 +25,5 @@ jobs:
|
||||||
uses: "phips28/gh-action-bump-version@master"
|
uses: "phips28/gh-action-bump-version@master"
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: "cat package.json"
|
||||||
|
run: cat ./package.json
|
||||||
|
|
11
index.js
11
index.js
|
@ -30,11 +30,20 @@ Toolkit.run(async tools => {
|
||||||
|
|
||||||
const currentBranch = /refs\/[a-zA-Z]+\/(.*)/.exec(process.env.GITHUB_REF)[1]
|
const currentBranch = /refs\/[a-zA-Z]+\/(.*)/.exec(process.env.GITHUB_REF)[1]
|
||||||
console.log('currentBranch:', currentBranch)
|
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('git', ['checkout', currentBranch])
|
||||||
await tools.runInWorkspace('npm',
|
await tools.runInWorkspace('npm',
|
||||||
['version', '--allow-same-version=true', '--git-tag-version=false', current])
|
['version', '--allow-same-version=true', '--git-tag-version=false', current])
|
||||||
console.log('current:', current, '/', 'version:', version)
|
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)
|
console.log('new version:', newVersion)
|
||||||
await tools.runInWorkspace('git', ['commit', '-a', '-m', `"ci: ${commitMessage} ${newVersion}"`])
|
await tools.runInWorkspace('git', ['commit', '-a', '-m', `"ci: ${commitMessage} ${newVersion}"`])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue