Skip to content

How to update the package.json version using semantic-release/git?

What I want to do

Based on the FAQ

I want to update the package.json version number on a new release.

What I did

  • Create a new empty private Github repository for an organization temp with a and .gitignore for node
  • Clone the repository
  • Fix the first commit message via git rebase -i --root and change it to feat: initial commit
  • Create a package.json with the content
  "name": "temp",
  "version": "0.0.0-development",
  "repository": {
    "type": "git",
    "url": "git+"
  • Setup semantic-release
npm install semantic-release -D
npm install @semantic-release/git -D
npm install @semantic-release/changelog -D
  • Create a .releaserc.json
    "plugins": [
  • Create a new Github workflow release.yml
name: Release on push on main branch

      - main

    runs-on: ubuntu-latest

      - name: Checkout repository
        uses: actions/[email protected]
          fetch-depth: 0

      - name: Setup Node
        uses: actions/[email protected]
          node-version: 16.x

      - name: Install dependencies
        run: npm install

      - name: Release
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: npx semantic-release --branches main
  • Commit everything with the message feat: next commit
  • Force push to origin

The problem

The package.json file won’t get updated by the semantic-release-bot. Even after modifying the file and pushing with feat: this should trigger a new release.


How can I tell semantic-release to push the new package version?


Based on this issue

you also need the npm module.

  • npm install @semantic-release/npm -D
  • add "private": true, to your package.json if you don’t want to publish to npm
  • add the npm plugin to the release configuration file (the order matters)


    "plugins": [