jsii-release
Version:
Release jsii modules to multiple package managers
70 lines (69 loc) • 2.05 kB
TypeScript
/**
* Creates GitHub releases via the GitHub REST API, tolerating a release that
* already exists so that re-running a release is a no-op rather than a
* failure.
*/
/**
* Options for creating a GitHub release.
*/
export interface GitHubReleaseOptions {
/**
* The tag name of the release (e.g. `v1.2.3`).
*/
readonly tag: string;
/**
* The repository to release to, in `owner/repo` format.
*/
readonly repository: string;
/**
* The token used to authenticate against the GitHub API.
*/
readonly token: string;
/**
* Markdown body of the release (release notes).
*
* @default - no release notes
*/
readonly body?: string;
/**
* The commitish the release tag will point to, if the tag does not exist
* yet. Ignored by GitHub when the tag already exists.
*
* @default - the repository's default branch
*/
readonly target?: string;
/**
* Mark the release as a prerelease.
*
* @default false
*/
readonly prerelease?: boolean;
/**
* Whether this release should be explicitly marked as the latest release
* (`true`) or explicitly not marked as the latest release (`false`).
*
* Passed to the GitHub API as `make_latest`.
*
* @default - not sent; GitHub determines the latest release
*/
readonly latest?: boolean;
/**
* Base URL of the GitHub API.
*
* @default 'https://api.github.com'
*/
readonly apiUrl?: string;
}
/**
* The outcome of `createGitHubRelease`.
*/
export type GitHubReleaseResult = 'created' | 'already_exists';
/**
* Creates a GitHub release.
*
* Returns `'already_exists'` instead of failing when a release for the tag
* already exists, so that a re-run of a (partially failed) release workflow is
* a no-op rather than a failure. The existing release is left untouched. Any
* other error is thrown.
*/
export declare function createGitHubRelease(options: GitHubReleaseOptions): Promise<GitHubReleaseResult>;