# Increment package version during deploy

**URL:** <https://discuss.circleci.com/t/increment-package-version-during-deploy/27282>\
**Category:** Deployments\
**Tags:** nodejs\
**Created:** [December 21, 2018, 10:55am UTC](https://discuss.circleci.com/t/increment-package-version-during-deploy/27282 "2018-12-21T10:55:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![StickNitro](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/sticknitro/32/20019_2.png) [@StickNitro](https://discuss.circleci.com/u/StickNitro)\
**Post date:** [December 21, 2018, 10:55am UTC](https://discuss.circleci.com/t/increment-package-version-during-deploy/27282/1 "2018-12-21T10:55:37Z")

</div>

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

```auto
      - 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

---

<div class="post-metadata">

**Author:** ![levlaz](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/levlaz/32/36978_2.png) [@levlaz](https://discuss.circleci.com/u/levlaz)\
**Post date:** [December 23, 2018, 10:08pm UTC](https://discuss.circleci.com/t/increment-package-version-during-deploy/27282/2 "2018-12-23T22:08:07Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![StickNitro](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/sticknitro/32/20019_2.png) [@StickNitro](https://discuss.circleci.com/u/StickNitro)\
**Post date:** [December 24, 2018, 9:26am UTC](https://discuss.circleci.com/t/increment-package-version-during-deploy/27282/3 "2018-12-24T09:26:20Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [January 3, 2019, 9:41am UTC](https://discuss.circleci.com/t/increment-package-version-during-deploy/27282/4 "2019-01-03T09:41:33Z")

</div>

Closed on January 3, 2019, 9:41am UTC

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