From 37a600476381b1ed152261018c51dbfc2d258262 Mon Sep 17 00:00:00 2001 From: phips28 Date: Sun, 27 Oct 2019 20:07:29 +0100 Subject: [PATCH] also set version on current opened branch --- .github/workflows/push.yml | 4 ++++ index.js | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index eceb38a..49d7734 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -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 diff --git a/index.js b/index.js index d4f1e76..c043ea1 100644 --- a/index.js +++ b/index.js @@ -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}"`])