release
Run the whole release in one command - bump, changelog, publish, commit, tag, push, provider release, social posts, branch sync and PR comment.
Usage
relizy release [options]Without a type flag, the bump of each package is computed from its commits (see SemVer Convention). The global options apply too (--dry-run, --group, --pr-number, --no-safety-check...).
Steps
Before the first step, release checks that it can run to the end, so a failure does not leave a half-done release:
- the new versions can be confirmed: an interactive terminal, or
--yes; - unless
--no-safety-check: the token of the git provider (and the AI provider when used), the access to the registry (npm and pnpm), the credentials of the enabled social platforms, and, when the release commit is pushed, that the branch is up to date with its upstream and can be pushed to, and that the branches to sync (the rules that match the released branch) exist and can get the release.
Then the steps run in this order:
| # | Step | What it does | Skipped by |
|---|---|---|---|
| 1 | Bump | Computes the new versions, asks to confirm them, writes the package.json files. When no commit triggers a bump, comments the PR (no-release), shows the summary, writes the report and stops with code 0, without success:release | - |
| 2 | Changelog | Writes the CHANGELOG.md files, then runs --format-cmd | --no-changelog |
| 3 | Publish | Runs --build-cmd, then publishes the packages in dependency order | --no-publish |
| 4 | Commit and tag | Commits the release files and creates the tags | --no-commit (tags: --no-git-tag) |
| 5 | Push | Pushes the commit and the tags | --no-push, --no-commit |
| 6 | Branch sync | Merges the released branch into the branches of the rules of sync that match it and pushes them, or opens a pull request into each one, right after the push. Only when a rule matches and the release commit is pushed, see Branch Sync | --no-sync, --no-push, --no-commit |
| 7 | Provider release | Creates the GitHub or GitLab releases | --no-provider-release |
| 8 | Social | Posts on X (Twitter) and Slack, when a platform is enabled in social | --no-social |
| 9 | PR comment | Comments the pull request or merge request of the release | --no-pr-comment |
| 10 | Summary and success:release | Shows the summary, writes the report, runs the success:release hook | - |
--no-commit skips the commit, the tags and the push. --no-git-tag only skips the tags: the commit is still created and pushed. Each step but the PR comment runs its before:*, success:* and error:* hooks.
A failed provider release, social post, branch sync (a conflict, a refused push) or PR comment does not stop the release: the step is marked as failed in the summary, and the release ends with success:release and code 0. Any other error, a failed check included, stops it, writes the failed report, posts a failed PR comment, runs the error:release hook and exits with code 1.
Branch Safety
The packages are published before the release commit and its tags are pushed, so a failed publication never leaves a tag behind. In return:
- Branch up to date: when the commit is pushed, relizy fetches the upstream branch during the checks and again right before publishing. If commits landed on it meanwhile, the release stops before publishing and restores the release files: run it again from the latest commit.
--dry-runstops too, except on a pull request or a merge request, where it only warns: the commits pushed after it started get their own run. Skipped on a detached HEAD or a branch without upstream. - Existing tags: right after the bump, the release fails if a tag it would create already exists, and tells how to recover.
- Rejected push: if the push is still rejected because the remote branch moved, relizy merges the remote branch into the release commit (the tags stay on the published commit) and pushes again. On a conflict, it aborts the merge, pushes the tags and prints the recovery command.
- Failed publication: the files written by the release are restored.
Options
| Flag | Description | Config |
|---|---|---|
--major, --minor, --patch | Force the bump type of the release | bump.type |
--prerelease, --premajor, --preminor, --prepatch | Bump to a prerelease version, see Prerelease Versions | bump.type |
--preid <id> | Prerelease identifier: alpha, beta, rc... | bump.preid |
--suffix <suffix> | With a prerelease type, replace the last number: 1.0.0-beta.0 becomes 1.0.0-beta.<suffix> | bump.suffix |
--canary | Publish a canary version of the current commit, see Canary | release.canary |
--force | Bump the packages even without a commit triggering a bump | - |
--yes | Confirm the new versions without asking. Required without an interactive terminal (CI) | bump.yes |
--from <ref> | Start of the commit range (tag or commit), instead of the last release tag | from |
--to <ref> | End of the commit range, HEAD by default | to |
--no-clean | Release with uncommitted changes. In a terminal, asks to confirm when they touch a file the release commits | release.clean |
--private-packages <mode> | release: version the private packages too (never published), ignore: leave them out | monorepo.privatePackages |
--no-changelog | Do not write the changelogs | release.changelog |
--format-cmd <cmd> | Command run after writing the changelogs, {{files}} replaced by their paths | changelog.formatCmd |
--no-format-cmd | Do not format the changelogs (no formatter detected) | changelog.formatCmd: false |
--no-root-changelog | Do not write the root CHANGELOG.md of a monorepo | changelog.rootChangelog |
--no-publish | Do not publish the packages | release.publish |
--build-cmd <cmd> | Command run before publishing, e.g. "pnpm build" (quoted: it is one argument) | publish.buildCmd |
--registry <url> | Registry to publish to: every package goes there, on top of its non-exclusive publish.registries entries | publish.registry |
--tag <tag> | Dist-tag of the publication. Default: latest for a stable version, next for a prerelease | publish.tag |
--access <type> | public or restricted | publish.access |
--otp <code> | One-time password of the registry (2FA) | publish.otp |
--publish-token <token> | Registry token, for npm, pnpm and bun | tokens.registry |
--skip-existing-versions | Skip the packages whose version is already on the registry instead of failing | publish.skipExistingVersions |
--no-commit | Do not commit, tag nor push | release.commit |
--no-git-tag | Do not create the tags | release.gitTag |
--no-verify | Commit with git commit --no-verify (skip the git hooks) | release.noVerify |
--no-push | Do not push the commit and the tags | release.push |
--no-provider-release | Do not create the GitHub or GitLab releases | release.providerRelease |
--provider <provider> | Git provider: github or gitlab | repo |
--token <token> | Token of the git provider (GitHub or GitLab) | tokens |
--ai, --no-ai | Force or disable the AI rewrite of the release notes and the social posts | AI |
--no-social | Do not post on social media | release.social |
--slack-format <format> | full (bodies and PR links), summary (commit titles) or none changelog in the Slack message | social.slack |
--sync <branch...> | Merge the released branch into these branches, instead of the rules of sync | sync.rules |
--no-sync | Do not merge the released branch into the branches of sync.rules | release.sync |
--sync-mode <mode> | push the branches, or open a pull-request into each one | sync.mode |
--no-pr-comment | Do not comment the pull request | release.prComment |
--pr-comment-mode <mode> | update the comment, append a new one, or recreate it at the bottom of the pull request | prComment.mode |
--report-json <file> | Write the report of the release to this JSON file | release.report |
--report-dotenv <file> | Write the outputs of the release to this dotenv file (RELIZY_RELEASED=true...), for GitLab CI | release.report |
--report-markdown <file> | Write the summary of the release to this markdown file | release.report |
On GitHub Actions, the outputs of the step and the summary of the run are written without option.
Canary
--canary publishes a temporary version of the current commit, {nextVersion}-0.canary-{sha} (e.g. 1.3.0-0.canary-a3f4b2c), with the canary dist-tag:
- it skips the changelog, the commit, the tags, the push, the provider release and the social posts;
- it keeps the checks, the publication and the PR comment;
- it restores the
package.jsonfiles once published (right away with--no-publish); - the version comes from the commits: the type flags,
--forceand--suffixare ignored; --preidchanges the identifier (1.3.0-0.snapshot-a3f4b2c),--tagthe dist-tag,--skip-existing-versionsmakes a re-run on the same commit succeed.
See Canary Releases.
Examples
# Preview: versions, changelogs, release notes, posts
relizy release --dry-run
# In CI
relizy release --yes
# A beta prerelease, published with the next dist-tag
relizy release --prerelease --preid beta --yes
# Version and tag, publish nothing
relizy release --no-publish --no-provider-release
# Canary of a pull request
relizy release --canary --yes --pr-number 42
# GitLab CI: the outputs for the next jobs
relizy release --yes --report-dotenv relizy.env
# Release main, then merge it into develop
relizy release --yes --sync developSee Also
relizy merge-preview: before the merge of a pull request, what its release will be- bump, changelog, publish, provider-release, social, sync, pr-comment: each step alone
- Release config
- CI/CD
release()