Commit Release Artifacts Back to Repository

Configure @semantic-release/git to commit updated files like CHANGELOG.md, package.json, and lock files back to the repository after a release. Includes skip-ci patterns.

Advanced Configuration

Detailed Explanation

Committing Release Artifacts

The @semantic-release/git plugin commits files modified during the release process back to your repository. This is essential when using the changelog plugin or when other plugins modify tracked files.

Configuration

{
  "branches": ["main"],
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    ["@semantic-release/changelog", {
      "changelogFile": "CHANGELOG.md"
    }],
    ["@semantic-release/npm", {
      "npmPublish": true
    }],
    "@semantic-release/github",
    ["@semantic-release/git", {
      "assets": [
        "CHANGELOG.md",
        "package.json",
        "package-lock.json",
        "npm-shrinkwrap.json"
      ],
      "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
    }]
  ]
}

Commit Message Template Variables

The message template supports these variables:

Variable Description Example
${nextRelease.version} The new version number 1.2.3
${nextRelease.gitTag} The git tag v1.2.3
${nextRelease.notes} The full release notes (multiline)
${nextRelease.type} The release type minor
${lastRelease.version} The previous version 1.1.0
${branch.name} Current branch name main

Avoiding CI Loops

The [skip ci] text in the commit message prevents CI systems from triggering a new pipeline for the release commit. Different CI systems recognize different patterns:

  • GitHub Actions: [skip ci], [ci skip]
  • GitLab CI: [ci skip], [skip ci]
  • CircleCI: [skip ci], [ci skip]

Plugin Order

The git plugin must be the last plugin in the array. It needs to run after all other plugins have finished modifying files (changelog writing, version bumping, etc.).

Use Case

Projects that track their changelog in version control and want the release commit to include the updated CHANGELOG.md and package.json with the new version number, creating a clean git history that reflects releases.

Try It — Semantic Release Config Builder

Open full tool