Release Flow
Contractual uses a two-PR pattern for releasing contract changes. This separates the work of making changes from the work of releasing them.
The two-PR pattern
Section titled “The two-PR pattern”Feature PR
Section titled “Feature PR”Your everyday work: spec changes plus a changeset file.
- Edit your spec files
- Run
contractual diffto see the impact - Run
contractual changesetto describe the changes - Commit spec + changeset files together
- Open a PR
The GitHub Action runs pr-check mode:
- Validates specs with linters
- Posts a diff table as a PR comment
- Warns about breaking changes
Version PR
Section titled “Version PR”When changesets accumulate on main, the Action creates a Version Contracts PR:
- Consumes all pending changesets
- Bumps versions according to changeset declarations
- Updates
versions.jsonandCHANGELOG.md - Creates new snapshots
Reviewers approve the Version PR to confirm the release is ready.
Release
Section titled “Release”When the Version PR merges:
- Git tags are created (e.g.,
orders-api@2.0.0) - GitHub Releases are created with changelogs
- Spec files can be attached as release artifacts
Full lifecycle diagram
Section titled “Full lifecycle diagram”What triggers each step
Section titled “What triggers each step”| Trigger | What happens |
|---|---|
| PR opened/updated | Action runs pr-check: lint, diff, post comment |
| PR merged to main | Changesets added to main branch |
| Changesets exist on main | Action creates Version PR |
| Version PR merged | Action creates tags and releases |
Where version bumps happen
Section titled “Where version bumps happen”Version numbers are never bumped on Feature PRs. The Version PR is the only place where versions change:
| File | When updated |
|---|---|
contractual.yaml | Never (versions not stored here) |
.contractual/versions.json | On Version PR |
.contractual/snapshots/*.yaml | On Version PR |
CHANGELOG.md | On Version PR |
This keeps Feature PRs focused on the actual changes, not version numbers.
Pre-release workflow
Section titled “Pre-release workflow”For alpha, beta, or release candidate versions:
- Enter pre-release:
contractual pre enter beta - Make changes and merge Feature PRs as normal
- Version PRs produce
-beta.0,-beta.1, etc. - Exit pre-release:
contractual pre exit - Final Version PR produces stable version
See Pre-release Versioning for details.
See also
Section titled “See also”- Local vs CI - Why Contractual is git-agnostic
- GitHub Action Setup - Configure the Action
- Changeset Format - Changeset file structure