Merge pull request #67 from dkaoster/allow-separate-branch

Allow the version upgrade to be executed on a separate branch
This commit is contained in:
Phil 2020-11-25 15:51:54 +01:00 提交者 GitHub
当前提交 56b044df6d
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23
共有 3 个文件被更改,包括 19 次插入1 次删除

查看文件

@ -76,3 +76,13 @@ Make sure you use the `actions/checkout@v2` action!
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGEJSON_DIR: 'frontend'
```
**TARGET-BRANCH:** Set a custom target branch to use when bumping the version. Useful in cases such as updating the version on master after a tag has been set (optional). Example:
```yaml
- name: 'Automated Version Bump'
uses: 'phips28/gh-action-bump-version@master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
target-branch: 'master'
```

查看文件

@ -31,6 +31,10 @@ inputs:
description: 'Custom dir to the package'
default: ''
required: false
target-branch:
description: 'A separate branch to perform the version bump on'
default: ''
required: false
default:
description: 'Set a default version bump to use'
default: 'patch'

查看文件

@ -29,7 +29,7 @@ Toolkit.run(async tools => {
const majorWords = process.env['INPUT_MAJOR-WORDING'].split(',')
const minorWords = process.env['INPUT_MINOR-WORDING'].split(',')
const preReleaseWords = process.env['INPUT_RC-WORDING'].split(',')
// if patch words aren't specified, any commit message qualifies as a patch
const patchWords = process.env['INPUT_PATCH-WORDING'] ? process.env['INPUT_PATCH-WORDING'].split(',') : null
@ -78,6 +78,10 @@ Toolkit.run(async tools => {
currentBranch = process.env.GITHUB_HEAD_REF
isPullRequest = true
}
if (process.env['INPUT_TARGET-BRANCH']) {
// We want to override the branch that we are pulling / pushing to
currentBranch = process.env['INPUT_TARGET-BRANCH']
}
console.log('currentBranch:', currentBranch)
// do it in the current checked out github branch (DETACHED HEAD)
// important for further usage of the package.json version