EasyBuild.ShipIt turns your commit history into versions, changelogs and release pull requests.
It is a .NET tool. For each project, it computes the next version from your commits, writes the changelog entry and opens a pull request for the release. When you merge that pull request, your workflow publishes the packages.
Try it
dotnet tool install EasyBuild.ShipIt
dotnet shipit init changelog
dotnet shipit --dry-run
init changelog creates a minimal CHANGELOG.md. --dry-run shows what ShipIt would do without changing a file or opening a pull request.
How a release works
You write Conventional Commits
ShipIt reads commits that follow Conventional Commits, in the form
<type>[optional scope][optional !]: <description>.An invalid commit stops the run, unless you pass
--skip-invalid-commit.ShipIt finds the projects
Each
CHANGELOG.mdin the repository is a project, except undernode_modules/,fable_modules/or a path ignored by Git.For each project, ShipIt reads the commits since the last release that touch the changelog's folder. The changelog stores that last commit as
last_commit_released.ShipIt picks the version
- A breaking change bumps the major version.
featandperfbump the minor version.fixbumps the patch version.
When the commits mix types, the highest bump wins. With no commit to release, ShipIt leaves the version as it is.
ShipIt writes the changelog
The new entry groups the commits under breaking changes, features, bug fixes and performance improvements, and links to the diff.
last_commit_releasedmoves to the last commit included in the release.ShipIt opens the pull request
ShipIt pushes the changes to a release branch and opens a pull request, or updates the one already open.
You merge, your workflow publishes
ShipIt does not publish anything. Your workflow runs a publish job when the head commit message starts with
chore: release.
By default ShipIt opens a pull request. --mode local only writes the changelog, and --mode push commits the release to the current branch and pushes it.
For an example of the output, see ShipIt's changelog, or the Glutinum 0.13.0 entry, which adds code samples to the generated lines.
Configuration lives in the changelog
There is no separate configuration file. Settings go in the YAML front matter of each CHANGELOG.md:
---
last_commit_released: abcd1234
include:
- ../Shared/
---
# Changelog
In a monorepo, each project has its own CHANGELOG.md, and only commits in the changelog's folder count.
Add shared folders with include. With depends_on, a project is released again when one of its dependencies is released.
All projects go into one pull request. I release the seven packages of Fable.Ripple this way.
With pre_release: beta, or --pre-release, a feat on top of 1.2.10 gives 1.3.0-beta.1, and the next release gives 1.3.0-beta.2. Remove the setting and the next release gives 1.3.0.
The README lists the other settings, including updaters, which write the new version into other files.
Set up GitHub
dotnet shipit init workflows
dotnet shipit init github
init workflows adds three workflows to .github/workflows/:
conventional-pr-title.ymlchecks that pull request titles follow Conventional Commits.test.ymlruns your tests.easybuild-shipit.ymlruns ShipIt when the tests pass onmain.
When the commit is a chore: release commit, easybuild-shipit.yml also publishes to NuGet with Trusted Publishing, so the repository stores no API key. Change the publish step if you release something else. The workflow runs dotnet tool restore, so install ShipIt in a tool manifest.
init github uses the GitHub CLI to switch on squash merges with the pull request title as the commit message, and to allow GitHub Actions to create pull requests. It only sends the settings that differ, so you can run it again.
Limits
- The pull request and push modes work with GitHub only, and need the
ghCLI. The code is written so other providers can be added: open an issue if you need one. - The version rules and the changelog sections are fixed.
In CI, the checkout must have enough history to reach last_commit_released. When it does not, the run fails with a Git error like this one:
fatal: Invalid revision range 33474b29d213862ab9876a3e414dfedfab99e2f9..HEAD
Increase fetch-depth in actions/checkout, or set it to 0 to fetch the full history.