From 9933542c7557915cb4c4fb165db7ec5857052944 Mon Sep 17 00:00:00 2001 From: phips28 Date: Fri, 3 Apr 2020 12:31:23 +0200 Subject: [PATCH 01/12] test checkout v2 --- .github/workflows/push.yml | 4 ++-- index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 45093a6..11a96df 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -3,7 +3,7 @@ name: "Bump Version" on: push: branches: - - "master" + - "checkout_v2" jobs: bump-version: @@ -12,7 +12,7 @@ jobs: steps: - name: "Checkout source code" - uses: "actions/checkout@v1" + uses: "actions/checkout@v2" with: ref: ${{ github.ref }} - name: "cat package.json" diff --git a/index.js b/index.js index 92fb48c..859e2ef 100644 --- a/index.js +++ b/index.js @@ -36,7 +36,7 @@ Toolkit.run(async tools => { await tools.runInWorkspace('git', ['config', 'user.email', '"gh-action-bump-version@users.noreply.github.com"']) const currentBranch = /refs\/[a-zA-Z]+\/(.*)/.exec(process.env.GITHUB_REF)[1] - console.log('currentBranch:', currentBranch) + console.log('currentBranch:', currentBranch, process.env.GITHUB_REF) // do it in the current checked out github branch (DETACHED HEAD) // important for further usage of the package.json version From a23b6e3498f1c757d9e0755a4de9c68dbf95d03d Mon Sep 17 00:00:00 2001 From: phips28 Date: Fri, 3 Apr 2020 12:36:28 +0200 Subject: [PATCH 02/12] test checkout v2 --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 859e2ef..2fa7913 100644 --- a/index.js +++ b/index.js @@ -54,7 +54,7 @@ Toolkit.run(async tools => { newVersion = execSync(`npm version --git-tag-version=false ${version}`).toString().trim() newVersion = `${process.env['INPUT_TAG-PREFIX']}${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}`]) const remoteRepo = `https://${process.env.GITHUB_ACTOR}:${process.env.GITHUB_TOKEN}@github.com/${process.env.GITHUB_REPOSITORY}.git` // console.log(Buffer.from(remoteRepo).toString('base64')) From 3fdb4b9a6b2e2707d1400808149b43f838984321 Mon Sep 17 00:00:00 2001 From: phips28 Date: Fri, 3 Apr 2020 12:40:31 +0200 Subject: [PATCH 03/12] test checkout v2 --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 2fa7913..bd84f83 100644 --- a/index.js +++ b/index.js @@ -55,12 +55,13 @@ Toolkit.run(async tools => { newVersion = `${process.env['INPUT_TAG-PREFIX']}${newVersion}` console.log('new version:', newVersion) // await tools.runInWorkspace('git', ['commit', '-a', '-m', `ci: ${commitMessage} ${newVersion}`]) - + console.log('before remoteRepo') const remoteRepo = `https://${process.env.GITHUB_ACTOR}:${process.env.GITHUB_TOKEN}@github.com/${process.env.GITHUB_REPOSITORY}.git` // console.log(Buffer.from(remoteRepo).toString('base64')) await tools.runInWorkspace('git', ['tag', newVersion]) await tools.runInWorkspace('git', ['push', remoteRepo, '--follow-tags']) await tools.runInWorkspace('git', ['push', remoteRepo, '--tags']) + console.log('after git push') } catch (e) { tools.log.fatal(e) tools.exit.failure('Failed to bump version') From 3f95ad9d4eaa9d0e28743e50a7a3bf9ef46b8710 Mon Sep 17 00:00:00 2001 From: phips28 Date: Fri, 3 Apr 2020 12:46:27 +0200 Subject: [PATCH 04/12] test checkout v2 --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 11a96df..8ce14ae 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -22,7 +22,7 @@ jobs: with: node-version: 8.10.0 - name: "Automated Version Bump" - uses: "phips28/gh-action-bump-version@master" + uses: "phips28/gh-action-bump-version@checkout_v2" with: tag-prefix: '' env: From d42ae1699bf0b5600ac53e5faf5e06d693da1cd1 Mon Sep 17 00:00:00 2001 From: Automated Version Bump Date: Fri, 3 Apr 2020 10:47:25 +0000 Subject: [PATCH 05/12] ci: version bump to v6.0.3 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4feffe7..cacbf6f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gh-action-bump-version", - "version": "6.0.2", + "version": "6.0.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 7568331..d7006c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gh-action-bump-version", - "version": "6.0.2", + "version": "6.0.3", "repository": { "type": "git", "url": "git+https://github.com/phips28/gh-action-bump-version.git" From a88ebf2f19bc99ee1bd8bc669e261387bafc5447 Mon Sep 17 00:00:00 2001 From: phips28 Date: Fri, 3 Apr 2020 12:48:15 +0200 Subject: [PATCH 06/12] test checkout v2 --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index bd84f83..b539286 100644 --- a/index.js +++ b/index.js @@ -36,7 +36,8 @@ Toolkit.run(async tools => { await tools.runInWorkspace('git', ['config', 'user.email', '"gh-action-bump-version@users.noreply.github.com"']) const currentBranch = /refs\/[a-zA-Z]+\/(.*)/.exec(process.env.GITHUB_REF)[1] - console.log('currentBranch:', currentBranch, process.env.GITHUB_REF) + console.log('currentBranch:', currentBranch) + console.log('event.pull_request.head.ref:', event.pull_request.head.ref) // do it in the current checked out github branch (DETACHED HEAD) // important for further usage of the package.json version From c4958f7006e2e9b2b1a6799cc25a8f422050687d Mon Sep 17 00:00:00 2001 From: phips28 Date: Fri, 3 Apr 2020 12:49:58 +0200 Subject: [PATCH 07/12] test checkout v2 --- index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/index.js b/index.js index b539286..2fca160 100644 --- a/index.js +++ b/index.js @@ -37,7 +37,6 @@ Toolkit.run(async tools => { const currentBranch = /refs\/[a-zA-Z]+\/(.*)/.exec(process.env.GITHUB_REF)[1] console.log('currentBranch:', currentBranch) - console.log('event.pull_request.head.ref:', event.pull_request.head.ref) // do it in the current checked out github branch (DETACHED HEAD) // important for further usage of the package.json version @@ -55,7 +54,6 @@ Toolkit.run(async tools => { newVersion = execSync(`npm version --git-tag-version=false ${version}`).toString().trim() newVersion = `${process.env['INPUT_TAG-PREFIX']}${newVersion}` console.log('new version:', newVersion) - // await tools.runInWorkspace('git', ['commit', '-a', '-m', `ci: ${commitMessage} ${newVersion}`]) console.log('before remoteRepo') const remoteRepo = `https://${process.env.GITHUB_ACTOR}:${process.env.GITHUB_TOKEN}@github.com/${process.env.GITHUB_REPOSITORY}.git` // console.log(Buffer.from(remoteRepo).toString('base64')) From 78011c267cd0d12feda6423785f2879f0d129c65 Mon Sep 17 00:00:00 2001 From: Automated Version Bump Date: Fri, 3 Apr 2020 10:50:57 +0000 Subject: [PATCH 08/12] ci: version bump to v6.0.4 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index cacbf6f..d3666eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gh-action-bump-version", - "version": "6.0.3", + "version": "6.0.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index d7006c5..f9628b8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gh-action-bump-version", - "version": "6.0.3", + "version": "6.0.4", "repository": { "type": "git", "url": "git+https://github.com/phips28/gh-action-bump-version.git" From a5b2f289e950cd796c73470cbe722cac37445f98 Mon Sep 17 00:00:00 2001 From: phips28 Date: Fri, 3 Apr 2020 13:04:35 +0200 Subject: [PATCH 09/12] test checkout v2 --- .github/workflows/push.yml | 2 +- index.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 8ce14ae..ed45934 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -20,7 +20,7 @@ jobs: - name: "Setup Node.js" uses: "actions/setup-node@v1" with: - node-version: 8.10.0 + node-version: 12 - name: "Automated Version Bump" uses: "phips28/gh-action-bump-version@checkout_v2" with: diff --git a/index.js b/index.js index 2fca160..78d2d28 100644 --- a/index.js +++ b/index.js @@ -54,13 +54,12 @@ Toolkit.run(async tools => { newVersion = execSync(`npm version --git-tag-version=false ${version}`).toString().trim() newVersion = `${process.env['INPUT_TAG-PREFIX']}${newVersion}` console.log('new version:', newVersion) - console.log('before remoteRepo') + const remoteRepo = `https://${process.env.GITHUB_ACTOR}:${process.env.GITHUB_TOKEN}@github.com/${process.env.GITHUB_REPOSITORY}.git` // console.log(Buffer.from(remoteRepo).toString('base64')) await tools.runInWorkspace('git', ['tag', newVersion]) await tools.runInWorkspace('git', ['push', remoteRepo, '--follow-tags']) await tools.runInWorkspace('git', ['push', remoteRepo, '--tags']) - console.log('after git push') } catch (e) { tools.log.fatal(e) tools.exit.failure('Failed to bump version') From b00c204e515dca1049e78ce76d21e8adab9d09a2 Mon Sep 17 00:00:00 2001 From: Automated Version Bump Date: Fri, 3 Apr 2020 11:05:36 +0000 Subject: [PATCH 10/12] ci: version bump to v6.0.5 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index d3666eb..d4e0c45 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gh-action-bump-version", - "version": "6.0.4", + "version": "6.0.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index f9628b8..773d9af 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gh-action-bump-version", - "version": "6.0.4", + "version": "6.0.5", "repository": { "type": "git", "url": "git+https://github.com/phips28/gh-action-bump-version.git" From ee0e78b19c53cd9801b2aea85ad68f5a14054ce4 Mon Sep 17 00:00:00 2001 From: phips28 Date: Fri, 3 Apr 2020 13:08:03 +0200 Subject: [PATCH 11/12] README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1606275..c56c739 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ It is meant to be used on every successful merge to master but you'll need to configured that workflow yourself. You can look to the [`.github/workflows/push.yml`](./.github/workflows/push.yml) file in this project as an example. +Make sure you use the `actions/checkout@v2` action! + ### Workflow * Based on the commit messages, increment the version from the lastest release. From 184f05b80264eccec5cf8abf71ecefa501bbab98 Mon Sep 17 00:00:00 2001 From: phips28 Date: Fri, 3 Apr 2020 13:08:39 +0200 Subject: [PATCH 12/12] reverted test --- .github/workflows/push.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index ed45934..01d096c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -3,7 +3,7 @@ name: "Bump Version" on: push: branches: - - "checkout_v2" + - "master" jobs: bump-version: @@ -22,7 +22,7 @@ jobs: with: node-version: 12 - name: "Automated Version Bump" - uses: "phips28/gh-action-bump-version@checkout_v2" + uses: "phips28/gh-action-bump-version@master" with: tag-prefix: '' env: