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-runParsing 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.tagNametemplate (v${version}by default), and Release titles are rendered from thegithub.releaseName/gitlab.releaseNametemplates (Release v${version}by default). - When syncing to GitHub, the SemVer pre-release flag is parsed automatically (for example,
1.4.0-beta.1is markedprerelease: trueautomatically).
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 inCHANGELOG.mdand have a matching local tag. - With a version list (
--sync-releases=v1.3.2,1.3.1): looks up each version's section inCHANGELOG.md. If a version is not present inCHANGELOG.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):
github.release: trueand/orgitlab.release: trueis explicitly configured (and the corresponding platform is not set tofalse).- When neither is explicitly enabled, the platform is inferred automatically from the
git remotehostname or the self-hosted configuration:- The remote host contains
github, orgithub.hostis configured (andgithub !== false) → GitHub - The remote host contains
gitlab, orgitlab.originis configured (andgitlab !== false) → GitLab
- The remote host contains
- If neither can be detected, you are asked to specify the platform explicitly with
--github.releaseor--gitlab.release.
Create, Skip, and Update Behavior
| Release already exists for the target tag | update not enabled (default) | --github.update / --gitlab.update enabled |
|---|---|---|
| No | Create (created) | Create (created) |
| Yes | Skip (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 toGITLAB_TOKENorCI_JOB_TOKEN+JOB-TOKEN) and follows allgithub.*/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.