From 156dc3eb63ba7c64430e87677736c7e483e49be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Bure=C5=A1?= Date: Wed, 20 Nov 2019 13:37:42 +0100 Subject: [PATCH] Add tag prefix --- .github/workflows/push.yml | 2 ++ action.yml | 5 +++++ index.js | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 49d7734..7c004d5 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -23,6 +23,8 @@ jobs: node-version: 8.10.0 - name: "Automated Version Bump" uses: "phips28/gh-action-bump-version@master" + wiht: + tag-prefix: '' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: "cat package.json" diff --git a/action.yml b/action.yml index e84718c..9716c4b 100644 --- a/action.yml +++ b/action.yml @@ -6,3 +6,8 @@ runs: branding: icon: chevron-up color: blue +inputs: + tag-prefix: + description: 'Prefix that is used for the git tag' + default: '' + required: false diff --git a/index.js b/index.js index 4714e3f..88fe514 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,4 @@ +const core = require('@actions/core') const { Toolkit } = require('actions-toolkit') const { execSync } = require('child_process') @@ -22,6 +23,8 @@ Toolkit.run(async tools => { version = 'minor' } + const tagPrefix = core.getInput('tag-prefix') + try { const current = pkg.version.toString() // set git user @@ -45,6 +48,7 @@ Toolkit.run(async tools => { ['version', '--allow-same-version=true', '--git-tag-version=false', current]) console.log('current:', current, '/', 'version:', version) newVersion = execSync(`npm version --git-tag-version=false ${version}`).toString().trim() + newVersion = `${tagPrefix}${newVersion}` console.log('new version:', newVersion) await tools.runInWorkspace('git', ['commit', '-a', '-m', `"ci: ${commitMessage} ${newVersion}"`])