How nwidart/laravel-modules releases are made. The automation lives in:
.github/workflows/release.yml: computes the next version and opens a release PR..github/workflows/tag-release.yml: tags the release and publishes the GitHub release when that PR is merged.cliff.toml: git-cliff configuration. It turns commit messages into a version bump and a CHANGELOG section.
The package major tracks the Laravel major: 13.x supports Laravel 13, 12.x supports Laravel 12.
| Release | When | Example |
|---|---|---|
| Major | A new Laravel major is supported. Made by hand, see New major release. | v14.0.0 |
| Minor | At least one feat commit since the last tag. |
v13.1.0 |
| Patch | Only fix, perf, refactor, docs, or other commits. |
v13.0.1 |
The version comes from the commit messages, so commits must follow Conventional Commits. CI checks this on every pull request.
Branches:
masterreleases the current major.composer.jsonextra.branch-aliassays which one (13.x-dev).N.x(for example12.x) is the maintenance branch of an older major.
Tags are vX.Y.Z. Each branch only sees the tags reachable from it, so a 12.x release continues from the latest v12 tag.
- Go to Actions > Release > Run workflow.
- Pick the branch:
master, or a maintenance branch such as12.x. - Pick
bump:auto(default):featcommits give a minor release, anything else gives a patch release.minororpatch: force that bump.
- The workflow opens a PR
chore(release): vX.Y.Zfromrelease/vX.Y.Z. The PR adds the new section toCHANGELOG.mdand shows it in the PR body. - Review the CHANGELOG section. To change it, push commits to the release branch. The GitHub release notes are read from
CHANGELOG.mdwhen the PR is merged. - Merge the PR.
tag-release.ymlthen:- creates the annotated tag
vX.Y.Zon the merge commit and pushes it, - creates the GitHub release
vX.Y.Zwith the CHANGELOG section as notes (marked "Latest" only formasterreleases), - deletes the release branch.
- creates the annotated tag
- Packagist picks up the tag through its GitHub webhook. Nothing else to do.
Merge the release PR soon. Commits that land on the branch between the workflow run and the merge are part of the tag but are not listed in its CHANGELOG section.
The Release workflow stops with an error when:
- it runs on a branch other than
masterorN.x, - there are no releasable commits since the last tag (merge commits,
chore(release), Pint style commits, and Dependabot commits do not count), - a breaking change (
feat!:orBREAKING CHANGE:) would bump the major: rerun withbump=minororbump=patch, or make a major release, - the major in
composer.jsonextra.branch-aliasdiffers from the latest tag on the branch (a new major was prepared but not tagged yet), - the tag
vX.Y.Zor the branchrelease/vX.Y.Zalready exists.
With git-cliff installed, from the branch you want to release:
git fetch --tags
git-cliff --use-branch-tags --bumped-version # next version
git-cliff --use-branch-tags --unreleased --strip all # next CHANGELOG sectionBy default the workflows use GITHUB_TOKEN. GitHub does not start workflows for pushes and PRs made with GITHUB_TOKEN, so the release PR shows no CI checks. Tags pushed with it still fire repository webhooks, so Packagist is not affected.
To get CI on release PRs, add a repository secret RELEASE_TOKEN: a fine-grained personal access token or GitHub App token for this repository with Contents: read and write and Pull requests: read and write. release.yml uses it when it is set.
- A new section in
CHANGELOG.md(generated byrelease.yml). - The tag
vX.Y.Zon the merged release PR. - A GitHub release for the tag.
- Packagist update, through the webhook.
Nothing in composer.json changes. It has no version key: Composer and Packagist read the version from the tag, and php artisan about reads it from Composer.
A new major follows a new Laravel major and is not made by the Release workflow. The Laravel upgrade PR on master makes these changes:
composer.json:laravel/framework,orchestra/testbench, andphpconstraints.composer.json:extra.branch-alias.dev-master(13.x-devto14.x-dev).README.md: compatibility table.AGENTS.md: the "master branch targets Laravel N" line..github/workflows/php.yml: PHP version matrix.
Before merging the upgrade PR, create the maintenance branch of the current major from its latest tag, so fixes for it can still be released:
git fetch --tags
git switch -c 13.x v13.0.5 # latest v13 tag
git push origin 13.xThe new 13.x branch has the release workflows of that tag. If they are missing or outdated, port them as described in Maintenance branches.
After the upgrade PR is merged:
- Add a
## 14.0.0 - YYYY-MM-DDsection toCHANGELOG.mdbelow the intro, in achore(release): v14.0.0commit (git-cliff --use-branch-tags --unreleased --tag v14.0.0 --strip alldrafts it). - Tag that commit and push the tag:
git tag -a v14.0.0 -m v14.0.0 && git push origin v14.0.0. - Create the GitHub release:
gh release create v14.0.0 --title v14.0.0 --notes-file <section>.
Later minor and patch releases on master use the Release workflow again.
GitHub runs a dispatched workflow from the branch it is dispatched on, and a pull_request workflow from the PR merged into its base branch. A maintenance branch can use the release automation only when it has its own copies of:
.github/workflows/release.yml.github/workflows/tag-release.ymlcliff.toml- the
commitsjob and the Pint commit message (style: apply pint fixes) from.github/workflows/php.yml
12.x does not have them yet. Cherry-pick the commit that adds release.yml, tag-release.yml, cliff.toml, and this file to 12.x before the first automated 12.x release. The php.yml on 12.x is older and laid out differently from master, so port the commits job and the Pint commit message by hand.
origin/12.x composer.json has extra.branch-alias "dev-master": "12.x-dev". Composer ignores that alias on a branch named 12.x, because the branch already resolves to 12.x-dev. The Release workflow reads only the alias value (12.x-dev), so it works either way.