release()
Run the whole release from Node.js with release() - bump, changelog, publish, git tags and provider releases - and read the report of the release.
function release(options?: Partial<ReleaseOptions>): Promise<ReleaseReport>release() runs the steps of relizy release and returns the report of the release: its status (released, or nothing when no commit triggers a bump), released (false in dry-run), version, the packages and versions by version group (release), the tags, and what each step did (steps). It throws when the release fails, once the report is written and the failed PR comment posted.
Options
The options are the flags of relizy release, camelCased, and override the config:
- Bump:
type(BumpReleaseType:'release', the default, computes it from the commits),preid,suffix,force,yes,clean,canary,privatePackages,dependencyTypes,capZeroMajor,outOfRangePeers,from,to - Changelog:
changelog,formatCmd,rootChangelog,includeCommitBody - Publish:
publish,registry,registries,tag(the dist-tag),access,otp,buildCmd,publishToken,skipExistingVersions,checkWorkspaceDependencies,args,packageManager,safetyCheckTimeout - Git:
commit,gitTag(the git tags),noVerify,push - Provider release:
providerRelease,provider,token(the token of the git provider),ai(also for the social posts) - Social and PR comment:
social,slackFormat,prComment,prNumber - Run:
report,safetyCheck,configName(a name or a path),profile,config,overrides,onProgress,dryRun,logLevel,groups - Application:
onConfirm(validates the versions instead of the prompt, seebump()),onOtp(gives the one-time password of the registry, seepublish())
config and overrides give a config already resolved, or a local overlay applied over the config file, without writing a file: see Shared Options. onProgress receives the events of the run, with what each step did as data.
See ReleaseOptions and ReleaseReport for the types.
Examples
import { release } from 'relizy'
const report = await release({ yes: true, social: false })
if (report.released) {
console.log(`Released ${report.version}: ${report.tags.join(', ')}`)
}A canary version of a pull request:
await release({ canary: true, yes: true, prNumber: 42 })With canary, the changelog, the commit, the git tags, the push, the provider release and the social posts are skipped. The version is {nextVersion}-0.canary-{sha} (preid replaces canary), published with the canary dist-tag unless tag is set. See Canary Releases.