Increment package version during deploy

I have a circleci script that runs my builds and tests and then on the master branch deploys to production. I would like to be able to increment the package version whenever a deploy happens, I have added the following in my yml file

      - run:
          name: bump package version
          command: |
            npm version prerelease --preid=alpha -m "Bumped version number to %s [ci skip]"
            git push origin master
            git push --tags

However when the deploy runs I get an error Command failed: git commit -m Bumped version number to 4.0.1-alpha.7 [ci skip]

It feels like this should be possible since the commit message tells CircleCI to skip the commit, how can I accomplish this?

This can’t be left to the developers to do prior to commits since this could be forgotten and then would not have an incremented tagged version in git at the time of the deployment

There’s not quite enough information here to help you. The git command failed for some reason, it is not clear why. Can you try running this with more verbose logging? Or maybe look at the exit code and share it here (unless its simply a generic 1 or something).

Turned out to be a few problems, this was actually due to not having the set in config so had to add `git config $CIRCLE_USERNAME.

I also had to update the remote url to HTTPS to resolve the SSH issue which I encountered after fixing this.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.