gh-action-bump-version
gh-action-bump-version copied to clipboard
version number not appearing correctly in the commit message
Thanks a lot for the great package. I've been able to use it successfully in my monorepo project.
I noticed one problem in the commit message. It's showing the package name
instead of the package version
.
Here is my current configuration:
name: 'Bump Version'
on:
push:
branches:
- 'my_branch'
jobs:
bump-version:
name: 'Bump Version on master'
runs-on: ubuntu-latest
steps:
- name: 'Checkout source code'
uses: 'actions/checkout@v2'
with:
ref: ${{ github.ref }}
- name: 'cat package.json'
run: cat ./package.json
- name: 'Automated Version Bump'
id: version-bump
uses: 'phips28/gh-action-bump-version@master'
with:
commit-message: 'version bump to {{version}} [skip ci]'
env:
PACKAGEJSON_DIR: 'src/web'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'cat package.json'
run: cat ./package.json
- name: 'Output Step'
env:
NEW_TAG: ${{ steps.version-bump.outputs.newTag }}
run: echo "new tag $NEW_TAG"
My package.json:
{
"name": "@app/web",
"version: "1.0.0",
...
}
Problem
expected commit message: version bump to 1.0.1
actual commit message: version bump to @app/web
Edge case:
- my current app name has
@
and-
. I tried to remove these special chars from the name. But it didn't solve the problem - the variable $NEW_TAG from the last step is printed correctly
Can you post the full logs of the action? We had some changes in the latest version. Maybe there is an edge case missing
I was trying to fix the problem. For some reason when I add this step to set the node version to 14 the action works:
- name: 'Setup Node.js'
uses: 'actions/setup-node@v1'
with:
node-version: 14
I tried to set up to 16 and it didn't work. So it may be something related to the node version
Anyway, here a log from a action that succeded, but with a wrong commit message:
tagPrefix: v
commit messages: [ 'wip\nundefined' ]
config words: {
majorWords: [ 'BREAKING CHANGE', 'major' ],
minorWords: [ 'feat', 'minor' ],
patchWords: null,
preReleaseWords: [ 'pre-alpha', 'pre-beta', 'pre-rc' ]
}
version action after first waterfall: patch
version action after final decision: patch
currentBranch: automatic_versioning
current 1: 2.0.10 / version: patch
newVersion 1: @app/web
v2.0.11
current 2: 2.0.10 / version: patch
execute npm version now with the new version: patch
newVersion 2: v2.0.11
newVersion after merging tagPrefix+newVersion: vv2.0.11
git commit failed because you are using "actions/checkout@v2"; but that doesnt matter because you dont need that git commit, thats only for "actions/checkout@v1"
✔ success Version bumped!
Note
I also had some problems using workspace in my root package. I'm using a different format:
"workspaces": {
"packages": [
"src/dir1",
"src/dir2",
"src/dir3"
]
},
Setting the node version to 14 also fixed this problem for me
Hi,
if you expect no tag prefix, you need to set it to an empty string:
tag-prefix: ''
https://github.com/phips28/gh-action-bump-version#tag-prefix
I think you might need to change the id from version-bump
to version_bump
. I saw it referenced in another issue. I guess hyphens in the id doesn't work when referencing output from previous steps.