Add tag prefix
This commit is contained in:
parent
8c7a9a465e
commit
156dc3eb63
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
4
index.js
4
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}"`])
|
||||
|
||||
|
|
Loading…
Reference in New Issue