phips28 / gh-action-bump-version Goto Github PK
View Code? Open in Web Editor NEWGitHub Action for automated npm version bump.
License: MIT License
GitHub Action for automated npm version bump.
License: MIT License
I might be doing something wrong, but if I set the target-branch property, I get the following:
✖ fatal Error: Command failed: git checkout development
error: pathspec 'development' did not match any file(s) known to git.
at makeError (/node_modules/execa/index.js:174:9)
at /node_modules/execa/index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async /index.js:99:5
My yml:
name: Publish release
on:
push:
branches:
- main
jobs:
publish:
name: "Publish on NPMJS"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- run: |
npm ci
npm run test
npm run doc
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
- name: Deploy JS Docs
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: jsdocs # The folder the action should deploy.
CLEAN: true # Automatically remove deleted files from the deploy branch
TARGET_FOLDER: jsdocs
COMMIT_MESSAGE: 'Update docs'
# https://github.com/phips28/gh-action-bump-version/blob/master/.github/workflows/push.yml
bump-version:
name: "Bump version on master"
needs: publish
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: "Setup Node.js"
uses: actions/setup-node@v1
with:
node-version: 12
- name: "Automated version bump"
id: version-bump
uses: phips28/[email protected]
with:
tag-prefix: ""
target-branch: "development"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Echo new tag"
env:
NEW_TAG: ${{ steps.version-bump.outputs.newTag }}
run: echo "new tag $NEW_TAG"
Hello, is there a way to customise the name of the commit actor? I've looked through the README and couldn't find anything about it.
Thanks for a useful action!
We noticed this in one of our projects; https://github.com/actions/checkout is called before phips28/gh-action-bump-version, and that worked great in actions/checkout@v1 of it.
In actions/checkout@v2, they changed to no longer use a detached HEAD at first, instead to use a branch directly; this causes gh-action-bump-version to fail.
Appears this is because gh-action-bump-version is trying to make the same commit twice (once on the initial branch, and once when checking out the second branch) - as those are now the same. (error line is here: https://github.com/phips28/gh-action-bump-version/blob/v5.0.19/index.js#L55 )
We got the same error @benitazhang mentioned here be1eb84#commitcomment-36934730 - failing when running git commit -a -m ci: version bump to [version]
(it is not related to the quotes change though, as that change works fine with actions/checkout@v1 - thanks for fixing that!)
I've just run into the issue which I have tag-prefix: 'alpha-'
and it is NOT being added to package.json
? It's working on the GitHub Tag itself but not package.json
.
bump-version:
name: Bump Version & Create GitHub Tag
runs-on: ubuntu-latest
needs: [checks]
outputs:
new-version: ${{ steps.version-bump.outputs.newTag }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Automated Version Bump
id: version-bump
uses: phips28/gh-action-bump-version@master
env:
GITHUB_TOKEN: ${{ github.token }}
PACKAGEJSON_DIR: 'libs/dot-components'
with:
commit-message: 'CI: bumps version to {{version}} [skip ci]'
major-wording: 'MAJOR'
minor-wording: 'MINOR'
target-branch: 'master'
preid: 'alpha'
tag-prefix: 'alpha-'
Originally posted by @CWSites in #84 (comment)
The latest version seems to be failing for me when it tries to call git fetch.
Here are the related steps from my actions.yml:
- uses: actions/checkout@v2
with:
ssh-key: ${{ secrets.SSH_KEY_FOR_SUBMODULES }}
- name: Bump Version
if: ${{ success() }}
uses: phips28/gh-action-bump-version@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
And here is the output from github:
Run phips28/gh-action-bump-version@master
with:
minor-wording: feat,minor
major-wording: BREAKING CHANGE,major
skip-tag: false
env:
NPM_CONFIG_USERCONFIG: /home/runner/work/_temp/.npmrc
NODE_AUTH_TOKEN: XXXXX-XXXXX-XXXXX-XXXXX
GITHUB_TOKEN: ***
/usr/bin/docker run --name aac2aac10c58df17bd46f38e0c76dd7c62d5ff_c44c18 --label aac2aa --workdir /github/workspace --rm -e NPM_CONFIG_USERCONFIG -e NODE_AUTH_TOKEN -e GITHUB_TOKEN -e INPUT_TAG-PREFIX -e INPUT_MINOR-WORDING -e INPUT_MAJOR-WORDING -e INPUT_SKIP-TAG -e INPUT_PACKAGEJSON_DIR -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/api/api":"/github/workspace" aac2aa:c10c58df17bd46f38e0c76dd7c62d5ff
currentBranch: master
current: 0.0.11 / version: patch
✖ fatal Error: Command failed: git fetch
Warning: Identity file /home/runner/work/_temp/10d8eec1-fe29-44c9-a9b9-13c0d69a9bfe not accessible: No such file or directory.
No RSA host key is known for github.com and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
at makeError (/node_modules/execa/index.js:174:9)
at /node_modules/execa/index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async /index.js:59:5
✖ fatal Failed to bump version
Hi, I'm trying to use this action in a repo configured with a protected main branch that requires 1 PR review.
When using this action, it fails because it tries to commit to main directly. I've tried using an alternative github token, one created with my own admin account, as I've read over the internet it would work, but it does not seem to have any impact.
Here is how i'm using the action
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
push:
branches: [ main ]
paths-ignore:
- 'package.json'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout repository
uses: actions/checkout@v2
- name: Increase version number
env:
GITHUB_TOKEN: ${{ secrets.ACTION_GITHUB_TOKEN }}
uses: phips28/[email protected]
and ACTION_GITHUB_TOKEN is defined in the secret of the repository based on my own user account.
We have security downstream to prevent non company authors from committing and deploying, so the version bump just sets off the security. How difficult would it be to make this information editable?
Thank you!
Hi! I've been using this action to bump my versions and it's very useful! In one of our repos however, our package.json is not in the root dir.
So I'd like to request a feature where I can set the working-directory for this action. I can't write js, so I can't create a PR, but what I have in mind is along these lines:
In my push.yml I'd add the last line of this:
- name: "Automated Version Bump"
uses: "phips28/gh-action-bump-version@master"
with:
tag-prefix: ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGEJSON_DIR: /src/static
And in index.js at line 6, you'd insert the js equivalent of this pseudocode:
if (isNotEmpty(process.env.working-directory))
setWorkingDirectory(process.env.working-directory)
Would something like this be possible?
Hi!
Thanks for creating this action!
In the workflow I'm working on I want to bump version after publishing a package, automatically forcing it to a prerelease. This works already, so that's good.
However, it would be nice to set the --preid option manually so its possible to have 2.0.3-alpha.0 instead of 2.0.3-0.
Example:
prerelease --preid=alpha
What do you think? Feasible?
With the inclusion of the major/minor wording params to optionally provide more keywords that cause those version bumps, it feels weird that we can't also supply our own wording for patches and release candidates.
So I was wondering, by default does this action auto-clone my github repo? cuz I'm noticing quite a spike of clones after I've added this action. Not sure if that's the case just asking. Also the ci is automatically branching master sometimes and not branching on others, and sometimes it takes multiple commits before a new version is pushed out (I have it set to on push to master) any idea how to fix that?
Can you add feature to incriment fersion based on PR labels? For example, "patch", or "feature" or "breaking".
I am trying to control the version bump for all MAJOR, MINOR, PATCH and pre-release as per semver.
I have the following configuration:
I want every push to trigger the pre-release version bump, except those that include the wordings as above,
but I get undefined
on my project version, for commit messages that do not include any wordings(pre-release bump expected):
messages: [ 'dependencies\nundefined' ]
currentBranch: main
current: 0.0.41-undefined.0 / version: prerelease --preid=undefined
current: 0.0.41-undefined.0 / version: prerelease --preid=undefined
new version: v0.0.41-undefined.1
✔ success Version bumped!
Edit: my commit message for the POC was dependencies
This used to work and when it executed today, it didn't.
I've set up a minimal working example here: https://github.com/syclik/test-action
I've done a little debugging:
package.json
fileTo test that, I ran the action on a new repo. I don't know the permissioning on GH Actions well enough, so just in case you can't see the details here: https://github.com/syclik/test-action/runs/559503561?check_suite_focus=true
(note the git status
step where it says that package.json
is modified)
P.S. Thank you!
I have a npm dependency that is OS specific (Windows and Mac use different versions of a BLE library).
When the bump-version commit is being made on the repo, it's removing the dependency from the package.json file.
I've tried changing the use of the bump-version action to use 'runs-on: windows-latest', but then it fails with 'Error: Container action is only supported on Linux'.
Please help.
Recently I started using github actions to automate my pipeline and your action is really helpful to automatically update my version.
The problem I've found is that you don't use the working-directory param, only being able to update the package.json on the root of the repository.
Do you have any plans to implement this feature?
Using the current latest version phips28/[email protected]
, I get the following message in CI:
Warning: Unexpected input(s) 'commit-message', valid inputs are ['entryPoint', 'args', 'tag-prefix', 'minor-wording', 'major-wording', 'patch-wording', 'rc-wording', 'skip-tag', 'PACKAGEJSON_DIR', 'target-branch', 'default']
And unfortunately that means I can't customise the commit message to include [skip ci]
, which is useful if you want to avoid repeating the CI pipeline after you push into the same branch.
The workaround has been to use:
if: ${{ !startsWith(github.event.head_commit.message, 'ci:') }}
but this is more maintenance hassle than I'd like as the if
condition has to be set on every step, whereas a [skip ci]
string would allow CI to ignore the commit entirely.
I clicked the rerun button in GitHub and this resulted in the following error:
messages: [
'fix: script page changed event\nundefined',
'fix: editor yt iframe background\nundefined',
'fix: form translation save and preselect languages\nundefined',
'fix(creator): hide lang prop and expand translations\nundefined',
'fix(CF): combine asid change listeners\nundefined',
'feat: prerelease changes\n\nCloses #77\nundefined',
'feat: usage hints\n\nCloses #69\nundefined',
'fix: ts type missing\nundefined',
'feat(form): comment response display\n\nCloses #78\nundefined',
'fix(form): rename file to image upload\nundefined',
"Merge branch 'stage' into dev\nundefined",
"Merge branch 'dev' into stage\nundefined"
]
currentBranch: stage
current: 0.6.0 / version: minor
current: 0.6.0 / version: minor
new version: v0.7.0
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"
✖ fatal Error: Command failed: git push ***github.com/glumb/repo.git --follow-tags
To https://github.com/glumb/repo.git
! [rejected] stage -> stage (fetch first)
error: failed to push some refs to '***github.com/glumb/repo.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
at makeError (/node_modules/execa/index.js:174:9)
at /node_modules/execa/index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async /index.js:118:7
✖ fatal Failed to bump version
Is there a way to cache the docker image of this action so it doesn't have to build each time? It takes a long time to run and it runs upfront before the rest of the steps.
For example, Python users could have their setup.py
or pyproject.toml
bumped too.
Hi there, thanks for maintaining this great action!
We recently modified our flow to involve an intermediate branch that PRs are merged to before going to our main branch. Unfortunately, since doing this, this action has failed to automate our version bump. Instead, when we do a "Rebase and Merge" from the intermediate branch, we get the "No action necessary!" message from the action.
Not sure what's causing this or if you have any recommendations for how we might be able to resolve this. much appreciated!
Hello!
When using the following config or omitting the tag-prefix option so the default applies, the tag is created with a 'v' prefix on the version number.
- name: 'Bump Version'
id: bump_version
uses: 'phips28/[email protected]'
env:
GITHUB_TOKEN: ${{ secrets.GITHUBTOKEN }}
with:
skip-tag: 'true'
tag-prefix: ''
target-branch: 'main'
commit-message: 'CI: Bump version to {{version}} [skip ci]'
major-wording: 'MAJOR,cut-major,major:'
minor-wording: 'add,Adds,new,feat, feat:'
rc-wording: 'RELEASE,alpha'`
Looking at the code, this seems to be added when executing
npm version --git-tag-version=false --allow-same-version=true 0.0.36
v0.0.36
I think the 'v' should be stripped off from output of this command so that the version number is normalised before adding the tag-prefix.
I also noticed that the commitMessageRegex replace on the {{version}} contains the v prefix too so this should become optional
When the script runs this instructions:
index.js -> line 45
await tools.runInWorkspace('git', ['commit', '-a', '-m',
"ci: ${commitMessage} ${newVersion}"])
...
index.js -> line 55
await tools.runInWorkspace('git', ['commit', '-a', '-m',
"ci: ${commitMessage} ${newVersion}"])
The final commit message contains double quotes -> "ci: version bump to v0.0.1".
I work in a project that runs the github app Semantic Pull Requests in the CI, so that commit message is not a conventional commit due the double quotes.
I have two workflows, one is triggered on 'push' event and the other is triggered on 'workflow_run' event. The workflow that is triggered on 'workflow_run' event uses the version bump action, but the action won't detect any commits from the branch that was checked out. If I combine those two workflows into one and use the 'push' event, then everything works correctly.
Can someone help or is this a bug?
I'm getting the following message in my action output on GitHub. The workflow shows that it is successful but if that's the case why is this showing?
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"
bump-version:
name: Bump Version & Create GitHub Tag
runs-on: ubuntu-latest
needs: [checks]
outputs:
new-version: ${{ steps.version-bump.outputs.newTag }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Automated Version Bump
id: version-bump
uses: phips28/gh-action-bump-version@master
env:
GITHUB_TOKEN: ${{ github.token }}
PACKAGEJSON_DIR: 'libs/dot-components'
with:
commit-message: 'CI: bumps version to {{version}} [skip ci]'
default: prerelease
major-wording: 'MAJOR'
minor-wording: 'minor'
# Providing patch-wording will override commits defaulting to a patch bump.
# patch-wording: 'patch'
rc-wording: 'alpha, RELEASE, BETA'
target-branch: 'master'
# rc-wording will override the preid
preid: 'alpha'
- name: Output Step
env:
NEW_TAG: ${{ steps.version-bump.outputs.newTag }}
run: echo "new tag $NEW_TAG"
Hello!
This action is cool! We are planning to use it.
Is there a way to disable the version tag?
Thank you!
Have a great day!
Sebastien
I'm getting an error when using this even though package.json
does exist...
Error: package.json could not be found in your project's root.
at Toolkit.getPackageJSON (/node_modules/actions-toolkit/lib/index.js:158:19)
at /index.js:11:21
at Function.<anonymous> (/node_modules/actions-toolkit/lib/index.js:109:31)
at step (/node_modules/actions-toolkit/lib/index.js:43:23)
at Object.next (/node_modules/actions-toolkit/lib/index.js:24:53)
at /node_modules/actions-toolkit/lib/index.js:18:71
at new Promise (<anonymous>)
at __awaiter (/node_modules/actions-toolkit/lib/index.js:14:12)
at Function.Toolkit.run (/node_modules/actions-toolkit/lib/index.js:100:16)
at Object.<anonymous> (/index.js:10:9)
I'll keep digging to see if I can figure out why.
guys thanks for great package 🤘
I would mention in docs that it is required to put env
with token in step params - was not obvious for me as I just started with github actions and I was getting 'incorrect name or password' error for quite a while today)
- name: Automated Version Bump
uses: phips28/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Is there a way to output the created tag ?
I need to use it in another action to create a new release with the created tag
Hello!
Following is the log of my Github action workflow.
messages: [
'ci: fixed invalid action name\nundefined',
'ci: version bumped into v2.3.21\nundefined',
'fix: fixed ci script\nundefined',
"Merge branch 'develop' into staging\nundefined"
]
✔ success No action necessary!
Though I expected the version would have been bumped into v2.3.22
, it didn't happen.
So, I opened the source code and I got confused.
gh-action-bump-version/index.js
Line 24 in e3cde4e
Shouldn't isVersionBump
be judged by the last commit, instead of all commits?
Please correct me if I'm mistaken. Or, I'll make a PR!
My config is below, recently I had the action run with a commit message add dispatch for release, breakout build to separate step\nundefined
which doesn't include my wording of MAJOR, minor, patch, alpha
. My suspicion is that it was because of the word release
however I would like to understand why that caused it to trigger if I explicitly do not have that word being watched.
What words are being watched by this action and how do I overwrite them properly? I need to make sure we don't have any accidental bumps.
- name: Automated Version Bump
id: version-bump
uses: phips28/gh-action-bump-version@master
env:
GITHUB_TOKEN: ${{ github.token }}
PACKAGEJSON_DIR: 'libs/dot-components'
with:
commit-message: 'CI: bumps version to {{version}} [skip ci]'
default: prerelease
major-wording: 'MAJOR'
minor-wording: 'minor'
patch-wording: 'patch'
rc-wording: 'alpha'
target-branch: 'master'
# rc-wording will override the preid
preid: 'alpha'
/usr/bin/docker run --name b3ac637fe3f33d1de420baf5e0923fe2f117b_ffa6d8 --label 3b3ac6 --workdir /github/workspace --rm -e GITHUB_TOKEN -e INPUT_TAG-PREFIX -e INPUT_PACKAGEJSON_DIR -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/headless-react/headless-react":"/github/workspace" 3b3ac6:37fe3f33d1de420baf5e0923fe2f117b
6
Couldn't find any commits in this event, incrementing patch version...
7
currentBranch: 15/merge
8
current: 0.1.0 / version: patch
9
✖ fatal Error: Command failed: git checkout 15/merge
10
error: pathspec '15/merge' did not match any file(s) known to git.
Keep getting the above when trying to run testing out this action on the yaml below
# This is a basic workflow to help you get started with Actions
name: Bump Version
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ adds_build_scripts ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
bump-version:
name: Automated Version Bump
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: "Setup Node.js"
uses: "actions/setup-node@v1"
with:
node-version: 12
- name: "Automated Version Bump"
uses: "phips28/gh-action-bump-version@master"
with:
tag-prefix: ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "cat package.json"
run: cat ./package.json
Hey guys - we use your build action across a bunch of our repos (thanks!) and they have all started failing in the last hour or so with the following error. I see you have recently merged a commit.
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module '/github/workspace/index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
It will be nice to have customize preid for prerelease build.
For example:
- name: 'Automated Version Bump'
uses: 'phips28/gh-action-bump-version@master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
default: prerelease
preid: 'xyz'
this will output version 1.0.1-xyz.0
Hello, I'm getting this error message when running this example on my private repo
Automated Version Bump
at Module._compile (internal/modules/cjs/loader.js:1201:30)
Run phips28/gh-action-bump-version@master
/usr/bin/docker run --name c20142dd32f8ea2a42b69f5cb2059f596a90_ee73bc --label 87c201 --workdir /github/workspace --rm -e GITHUB_TOKEN -e INPUT_TAG-PREFIX -e INPUT_PACKAGEJSON_DIR -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/discord-tibia-bot/discord-tibia-bot":"/github/workspace" 87c201:42dd32f8ea2a42b69f5cb2059f596a90
✖ fatal TypeError: Cannot read property 'map' of undefined
at /index.js:15:34
at Function.<anonymous> (/node_modules/actions-toolkit/lib/index.js:109:31)
at step (/node_modules/actions-toolkit/lib/index.js:43:23)
at Object.next (/node_modules/actions-toolkit/lib/index.js:24:53)
at /node_modules/actions-toolkit/lib/index.js:18:71
at new Promise (<anonymous>)
at __awaiter (/node_modules/actions-toolkit/lib/index.js:14:12)
at Function.Toolkit.run (/node_modules/actions-toolkit/lib/index.js:100:16)
at Object.<anonymous> (/index.js:11:9)
at Module._compile (internal/modules/cjs/loader.js:1201:30)
Reading the code at index.js:15:34, looks like the event could not find any commit messages... it's weird
Don't know if I'm doing something wrong here.
My CI action looks like this:
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
steps:
# Step for build/test
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test
# Step for automatic bump version
- name: "Checkout source code"
uses: "actions/checkout@v2"
with:
ref: ${{ github.ref }}
- name: "cat package.json"
run: cat ./package.json
- name: "Setup Node.js"
uses: "actions/setup-node@v1"
with:
node-version: 12
- name: "Automated Version Bump"
uses: "phips28/gh-action-bump-version@master"
with:
tag-prefix: ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "cat package.json"
run: cat ./package.json
Could anyone help me with that?
Am I missing something?
Maybe some additional config?
Thanks!
Hello, thanks for making this plugin!
I'm running into a nullpointer, and I think it may be due to the fact that my github action runs when the pull request is closed and merged to master.
Couldn't find any commits in this event, incrementing patch version...
✖ fatal TypeError: Cannot read property '1' of null
at /index.js:42:79
index.js
const currentBranch = /refs\/[a-zA-Z]+\/(.*)/.exec(process.env.GITHUB_REF)[1]
console.log('currentBranch:', currentBranch)
The problem I have is my github action also publishes to NPM, so I don't really want to publish every time a branch is opened. Do you have a recommended workaround for this? Is this just not a valid usecase?
Would it be possible to add an option to skip version bumps if none of the wording matches are present? This would be ideal for when I'm only making a documentation change outside of the code and don't want a new version to be published simply for that.
Thanks!
Hi guys,
Thank you for the GH action. It is awesome :).
I'm using it before build and publish to npm job. Even with both bump and build actions working as expected the publish file still recognizes the old version.
Here you can see the version bumped:
Run phips28/gh-action-bump-version@master
/usr/bin/docker run --name be76dbf7e6f90e41724bd4a6120c9038c36f62_927adb --label be76db --workdir /github/workspace --rm -e GITHUB_TOKEN -e INPUT_TAG-PREFIX -e INPUT_PACKAGEJSON_DIR -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/auth-mech/auth-mech":"/github/workspace" be76db:f7e6f90e41724bd4a6120c9038c36f62
currentBranch: master
current: 0.1.6 / version: patch
current: 0.1.6 / version: patch
new version: v0.1.7
But in the publish job it didn't realize the new version:
npm notice
npm notice 📦 @joaomelo/[email protected]
npm notice === Tarball Contents ===
npm notice 35.1kB LICENSE
npm notice 7.7kB lib/dist/index.js
npm notice 1.8kB package.json
npm notice 11.8kB README.md
I know it is probably something I did wrong. But can you help me in any way?
Thank you again.
I want to use this action for the workflow in repo. I just want to know if it is possible to control when to create or not create a github tag when a version is bumped.
We have set the commit message of the version bump to include [skip-ci] which ensures that our main branch push workflow doesn't execute in a continuous loop when the package.json file with the new version is committed.
However Im finding that our downstream workflow that is triggered when the tag is created does not execute. I think this is because by default the same commit message including [skip-ci] is used when creating the tag.
This action should allow a tag commit message to be optionally specified to allow [skip-ci] to be removed and this trigger any downstream workflows.
I'm using a monorepo setup and I have a package.json
in the root directory, however that is not the one I want to bump. I have the following configuration set and when cat ./package.json
runs it completely ignores the PACKAGEJSON_DIR
.
jobs:
bump-version:
name: 'Bump Version on master'
runs-on: ubuntu-latest
steps:
- name: 'Checkout code'
uses: 'actions/checkout@v2'
with:
ref: ${{ github.ref }}
- name: 'cat package.json'
run: cat ./package.json
- name: 'Setup Node.js'
uses: 'actions/setup-node@v1'
with:
node-version: 12
- name: 'Automated Version Bump'
id: version-bump
uses: 'phips28/gh-action-bump-version@master'
env:
GITHUB_TOKEN: ${{ github.token }}
PACKAGEJSON_DIR: './libs/dot-components'
with:
tag-prefix: ''
- 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"
We are finding that after phips28/gh-action-bump-version, even on latest tag, that the package-lock.json isn't fully updated when you use a package-lock V2 version (npm@7 or later). Is there a way to bump the npm version it runs with?
Specifically:
We end up in this state:
{
"name": "project",
"version": "1.2.16",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"version": "1.2.15",
So this means when you run npm i
locally, it creates an updated package-lock.json to get the non-updated one up to date, causing excess commits and churn.
I love the action. It works fine!
Now I want to add other release notes out of my commits and not only "ci: version bump to ..*".
Is this possible?
And another question:
If one commit in the process includes "major" and the current version is 0.9.5, the result is 7.0.0 Am I right?
Thanks for your help!
It seems in 8.0.15 this github action does not default to patch anymore.
If you do not provide a patch-wording, it sets the version to null, and then exits without bumping the version.
I made a PR that should fix this here: #64
Hi, README says the following:
- Push the bumped npm version in package.json back into the repo.
- Push a tag for the new version back into the repo.
Since #37 the bumped npm version in package.json is only pushed back into the repo when you also want to push the tag for the new version back into the repo.
The bumped npm version should be pushed regardless of whether I want to push the tag for the new version.
~ Fabian :)
Logs.txt
Hi! So far this GitHub action has been fantastic what I need it for. Thanks for much! However, recently I've run into a problem. For some reason, I keep running into an issue when the Docker container tries installing the node modules via npm from npm ci --only=production
.
I get the following error:
npm ERR! The `npm ci` command can only install with an existing package-lock.json or
npm ERR! npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or
npm ERR! later to generate a package-lock.json file, then try again.
As far as I can tell the package-lock.json
file is being copied over, so I'm not really sure what the issue is. I also have a fork of this project too and tried having NPM automatically recreate the package-lock.json
file. That hasn't fixed the issue either. Any ideas on why this is happening all of a sudden? I'm assuming it's most likely a bad update with something, but I've been unable to pinpoint what exactly that would be. Thanks!
so this started a couple days ago. The v is missing in front of the tag for the version number. I'm currently pointed at your master branch for the action. it's now resulting in this output when the action is run and doesn't show the updated "new version"
currentBranch: master
current: 2.1.47 / version: patch
current: 2.1.47 / version: patch
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!
Even though it shows Version Bumped, Previously this would be the output.
currentBranch: master
current: 2.1.46 / version: patch
current: 2.1.46 / version: patch
new version: v2.1.47
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!
The tag created is now 2.1.47 rather than v2.1.47. I rolled back to [email protected] and it is working again as expected.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.