A Strategy to publish NPM packages source controlled in GitHub.
This strategy will:
Some of the below commands will not be used when config
syncRemote
isfalse
- Generate a changelog and prepend it to the changelog file using FileWriterCommand
- Create a GitHub release using GithubCreateReleaseCommand
- Comment on GitHub issues mentioned in the release commits using GithubCreateIssueCommentsCommand
- Bump the package.json version property to the next version using NpmBumpPackageVersionCommand
- Create a Git tag named after the next version using GitTagCommand
- Commit the generated changelog & changed package.json using GitCommitCommand
- Push the commit using GitPushBranchCommand
- Publish the package to the npm registry using NpmPublishPackageCommand
Type: object literal
Type: boolean
Default: false
This flag controls whether to commit and push the package.json
and, in case maintainChangelog
is true, the changelog file as well.
Enabling this when the remote branch is protected will require a bypass.
See discussions/25305
Type: string
Default: main
When the branch name is equal to configured value the published npm dist tag is latest.
Additionally. this determines the GitHub prerelease
flag. See "Create a release"
Type: Logger
Default: processStdoutLogger
Type: Release
Default: git-tag-based-release
Type: string
Default: origin
Type: boolean
Default: false
Type: string
Default: process.env.RELEASE_ACTOR
A shorthand to perform Git commits using a specific author & committer email and name.
Example:
/*
* The value must be in author format: "NAME <EMAIL>"
*/
{ gitActor: "bot <[email protected]>" }
// It is also possible to explicitly use the equivalent environment variables:
//
// GIT_COMMITTER_NAME: bot
// GIT_COMMITTER_EMAIL: [email protected]
// GIT_AUTHOR_NAME: bot
// GIT_AUTHOR_EMAIL: [email protected]
Type: string
Default: process.cwd()
Type: string
Default: ${workingDirectory}/CHANGELOG.md
Type: string
Default: process.env.GITHUB_PAT_TOKEN
The token to use when interacting with GitHub REST API
GitStrategy options are also applicable.
const { SDK } = require("@abstracter/atomic-release");
SDK.githubNpmPackageStrategy().then(strategy => strategy.run());