Add tag prefix

This commit is contained in:
Michal Bureš 2019-11-20 13:37:42 +01:00
parent 8c7a9a465e
commit 156dc3eb63
3 changed files with 11 additions and 0 deletions

View File

@ -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"

View File

@ -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

View File

@ -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}"`])