Skip to content

Sync and Backfill Releases from CHANGELOG.md ​

If a project previously only pushed Git tags locally and forgot to create GitHub / GitLab Releases, or if you want to backfill or update the bodies of historical Releases in bulk based on a revised CHANGELOG.md, use the --sync-releases mode.

This mode performs the sync operation only. It automatically skips the version increment, file modifications, Git commits/tags, and npm publishing.

Common Commands ​

bash
# Sync every historical version in CHANGELOG.md that already has a matching local Git tag
release --sync-releases

# Sync only the specified single or multiple versions (comma-separated; works with or without the v prefix)
release --sync-releases=v1.3.2
release --sync-releases=v1.3.2,1.3.1,1.3.0

# Allow overwriting existing Releases (existing Releases are skipped by default)
release --sync-releases --github.update
release --sync-releases --gitlab.update

# Specify the target platform explicitly (by default it is detected from the remote URL)
release --sync-releases --github.release
release --sync-releases --gitlab.release

# Dry run: only view the sync plan (which tags will be created/updated/skipped) without calling any write API
release --sync-releases --dry-run

Parsing Rules and Supported CHANGELOG.md Formats ​

The file path is taken from changelog.infile (CHANGELOG.md by default). Both the level-2 and level-3 version heading formats commonly produced by conventional-changelog and Keep a Changelog are supported:

markdown
## [1.3.2](https://github.com/org/repo/compare/v1.3.1...v1.3.2) (2026-12-01)
### [1.3.1](https://github.com/org/repo/compare/v1.3.0...v1.3.1) (2026-11-30)
## 1.3.0 (2026-11-20)
## [v1.2.0] - 2026-10-15
  • A non-version level-2 heading (such as ## Unreleased) automatically ends the preceding version section.
  • If the file contains duplicate version headings, only the first occurrence of each section is kept.
  • Tag names are built from the git.tagName template (v${version} by default), and Release titles are rendered from the github.releaseName / gitlab.releaseName templates (Release v${version} by default).
  • When syncing to GitHub, the SemVer pre-release flag is parsed automatically (for example, 1.4.0-beta.1 is marked prerelease: true automatically).

Version Filtering Logic ​

  • Without a version list (--sync-releases): lists all local Git tags (git tag --list) and syncs only the versions that are found in CHANGELOG.md and have a matching local tag.
  • With a version list (--sync-releases=v1.3.2,1.3.1): looks up each version's section in CHANGELOG.md. If a version is not present in CHANGELOG.md, a warning is printed and that version is skipped.
  • If there are no versions left to sync, a notice is printed and the process ends with exit code 0.

Hosting Platform Detection Rules ​

The sync target is determined with the following priority (GitHub and GitLab can both be enabled at the same time):

  1. github.release: true and/or gitlab.release: true is explicitly configured (and the corresponding platform is not set to false).
  2. When neither is explicitly enabled, the platform is inferred automatically from the git remote hostname or the self-hosted configuration:
    • The remote host contains github, or github.host is configured (and github !== false) → GitHub
    • The remote host contains gitlab, or gitlab.origin is configured (and gitlab !== false) → GitLab
  3. If neither can be detected, you are asked to specify the platform explicitly with --github.release or --gitlab.release.

Create, Skip, and Update Behavior ​

Release already exists for the target tagupdate not enabled (default)--github.update / --gitlab.update enabled
NoCreate (created)Create (created)
YesSkip (skipped)Update (updated)

Authentication and Dry Run ​

  • Real sync: requires the environment variable token of the corresponding platform (GitHub defaults to GITHUB_TOKEN; GitLab defaults to GITLAB_TOKEN or CI_JOB_TOKEN + JOB-TOKEN) and follows all github.* / gitlab.* configuration, such as proxies, enterprise domains, and CA certificates.
  • Where the token goes: the "automatic inference" above is used only to detect the platform. It does not decide where the token is sent. Tokens from environment variables are only sent to the official domains (github.com / gitlab.com), the hosts explicitly set in the configuration (github.host / gitlab.origin), or the address that the CI platform declares for itself (GITHUB_SERVER_URL / CI_SERVER_URL). When the repository is on a self-hosted instance, the host must be configured explicitly, otherwise a notice is printed and the run stops (see GitHub Releases / GitLab Releases).
  • Dry run (--dry-run): sends no create or update requests. If a token is configured on the machine, it queries the remote read-only to check whether the corresponding Releases already exist, so that the plan of what will be "created / updated / skipped" is shown accurately. Without a token, it shows the plan of what would be created.