release-please
repository·main·Indexed 25 days ago
https://github.com/googleapis/release-pleaseAn automation tool that handles CHANGELOG generation, GitHub release creation, and version bumping by parsing Conventional Commit messages. It supports various release strategies for ecosystems including Node, Python, Go, Rust, Java, and more, and can be deployed via GitHub Action or CLI.
What's inside release-please
- This library follows Semantic Versioning.
Identify the Public API surface
mainThe public interface of
release-pleaseis strictly limited to:- The
release-pleaseCLI binary. - Exported members from
index.ts.
All other classes and interfaces are considered internal implementation details and are subject to change without notice. Avoid importing from internal paths (e.g.,
release-please/src/internal/...) as these are not guaranteed to be stable.- The
Understand Java Snapshot versioning
mainWhen using Java or Maven strategies, Release Please generates SNAPSHOT versions after each release. A SNAPSHOT is created as a separate "release" Pull Request that updates all affected files but does not trigger an actual release or a Git tag. These snapshot bump PRs are identified by theautorelease: snapshotlabel.Manually trigger a specific version number
mainTo force Release Please to open a pull request for a specific version, include
Release-As: x.x.x(case insensitive) in the commit body. This can be done using an empty commit.Example command:
git commit --allow-empty -m "chore: release 2.0.0" -m "Release-As: 2.0.0"Understand the Release Please lifecycle
mainThe
release-pleaseworkflow automates the creation of release pull requests and GitHub releases based on your commit history. The standard lifecycle is:- Commit: A commit is merged or pushed to your release branch (e.g.,
main). - Propose:
release-pleaseopens a release pull request that proposes version bumps and appends release notes to yourCHANGELOG.md. - Review: A maintainer reviews and merges the release pull request.
- Release:
release-pleaseautomatically creates a new GitHub release using the release notes extracted from the merged pull request.
Note:
release-pleasedoes not publish your packages or applications; it only manages the versioning and release metadata. You should set up separate automation to trigger publishing upon the creation of a GitHub release.- Commit: A commit is merged or pushed to your release branch (e.g.,
Write Conventional Commits for automated versioning
mainRelease Please uses Conventional Commit messages to determine SemVer bumps:
fix:: Correlates to a patch release.feat:: Correlates to a minor release.feat!:,fix!:,refactor!:, etc.: The!indicates a breaking change, resulting in a major release.
Note: To ensure a clean history and predictable changelogs, it is highly recommended to use squash-merges when merging pull requests.
Use the `java` Strategy for Java projects
mainThejavastrategy is a general-purpose strategy for Java projects that does not automatically update any files. To manage version bumps in your project files (such aspom.xmlor other configuration files), you must use theextra-filesconfiguration to specify which files should be updated.Install the release-please CLI
mainInstall the
release-pleaseCLI globally using npm to make the command available in your terminal.npm i release-please -gUpdate Arbitrary Files with Annotations
mainUse the
genericupdater to update version information in arbitrary files by adding specific annotations (comments) to the file.Inline Annotations:
x-release-please-versionx-release-please-majorx-release-please-minorx-release-please-patch
Block Annotations: Start a block with
x-release-please-start-version(orstart-major,start-minor,start-patch) and end it withx-release-please-end.To force the generic updater, specify the type as
genericin theextra-filesconfiguration.{ "extra-files": [ { "type": "generic", "path": "path/to/file.yml" } ] }Understand Release PR lifecycle and status labels
mainRelease Please maintains 'Release PRs' that stay up-to-date as new work is merged into your default branch. When you are ready to release, merge the Release PR. Upon merging, Release Please updates changelogs (e.g.,
CHANGELOG.md,package.json), tags the commit with the version number, and creates a GitHub Release.Monitor the PR lifecycle using these status labels:
autorelease: pending: The initial state before the PR is merged.autorelease: tagged: The PR has been merged and the release has been tagged in GitHub.autorelease: snapshot: A special state for snapshot version bumps.autorelease: published: A recommended convention indicating a GitHub release has been published based on the PR.
Manage Java Bill of Materials (BOM) versioning
mainFor
pom.xmlprojects acting as Bill of Materials (BOM), Release Please infers dependency bump types fromdeps:commits. The semantic version bump of the BOM artifact must reflect the proposed version bump of its dependencies.For example, if a dependency undergoes a major version bump, the BOM artifact's version must also undergo an associated major version bump.
Set up Release Please
mainYou can deploy Release Please in several ways:
- GitHub Action (Recommended): Use the googleapis/release-please-action for the easiest setup.
- CLI: Run it as a command-line tool. See
docs/cli.mdfor configuration options.
To onboard a new repository, it is recommended to bootstrap a manifest config.