This checklist walks you through releasing a stable version. See below for the checklist for release candidates.
We'll use v4.6.0 as the intended release version as a running example.
script/release_checklist.py v4.6.0 to check the status of the release. This script is idempotent, and should be safe to run at any stage of the release process. Note that as of v4.19.0, this script takes some autonomous actions, which can be prevented via --dry-run.git checkout releases/v4.6.0 (This branch should already exist, from the release candidates.)git pullsrc/CMakeLists.txt, verify you seeset(LEAN_VERSION_MINOR 6) (for whichever 6 is appropriate)set(LEAN_VERSION_IS_RELEASE 1)git tag v4.6.0git push $REMOTE v4.6.0, where $REMOTE is the upstream Lean repository (e.g., origin, upstream)https://github.com/leanprover/lean4/actions/workflows/ci.yml, looking for the v4.6.0 tag.script/release_notes.py --since v4.5.0 on the releases/v4.6.0 branch, and see the section “Writing the release notes” below for more information.Manual/Releases/v4.6.0.lean. It's best if you update these at the same time as a you update the lean-toolchain for the reference-manual repository, see below.v4.6.0 release appears.lean-release-managers team at both leanprover-community and leanprover. Contact Kim Morrison (@kim-em) to arrange access.script/release_repos.yml,script/release_steps.py v4.6.0 <repo> (e.g. replacing <repo> with batteries), which will walk you through the following steps:master/main (as specified in the branch field), called bump_to_v4.6.0.lean-toolchain to leanprover/lean4:v4.6.0.lakefile.toml or lakefile.lean, if there are dependencies on specific version tags of dependencies, update them to the new tag. If they depend on main or master, don‘t change this; you’ve just updated the dependency, so lake update will take care of modifying the manifest.lake updatechore: bump toolchain to v4.6.0 and push.script/release_checklist.py will then create the tag v4.6.0 from master/main and push it (unless toolchain-tag: false in the release_repos.yml file)script/release_checklist.py will then merge the tag v4.6.0 into the stable branch and push it (unless stable-branch: false in the release_repos.yml file).doc-gen4 has additional dependencies which we do not update at each toolchain release, although occasionally these break and need to be updated manually.verso:subverso dependency is unusual in that it needs to be compatible with every Lean release simultaneously. Usually you don't need to do anything. If you think something is wrong here please contact David Thrane Christiansen (@david-christiansen)lake update and lake build are expected.reference-manual: the release notes generated by script/release_notes.py as described above must be included in Manual/Releases/v4.6.0.lean, and import and include statements adding in Manual/Releases.lean.ProofWidgets4 uses a non-standard sequential version tagging scheme, e.g. v0.0.29, which does not refer to the toolchain being used. You will need to identify the next available version number from https://github.com/leanprover-community/ProofWidgets4/releases, and push a new tag after merging the PR to main.mathlib4:lakefile.toml should always refer to dependencies via their main or master branch, not a toolchain tag (with the exception of ProofWidgets4, which must use a sequential version tag).repl: There are two copies of lean-toolchain/lakefile.lean: in the root, and in test/Mathlib/. Edit both, and run lake update in both directories.lean-fro.org: After updating the toolchains and running lake update, you must run scripts/update.sh to regenerate the site content. This script updates generated files that depend on the Lean version. The release_steps.py script handles this automatically.master/main branch has already been moved to a nightly toolchain that comes after the stable toolchain we are targeting. In this case it is necessary to create a branch releases/v4.6.0 from the last commit which was on an earlier toolchain, move that branch to the stable toolchain, and create the toolchain tag from that branch.script/release_checklist.py v4.6.0 one last time to check that everything is in order.v4.6.0. Please see previous announcements for suggested language. You will want a few bullet points for main topics from the release notes. If there is a blog post, link to that from the zulip announcement.This checklist walks you through creating the first release candidate for a version of Lean.
For subsequent release candidates, the process is essentially the same, but we start out with the releases/v4.7.0 branch already created.
We'll use v4.7.0-rc1 as the intended release version in this example.
nightly-2024-02-29 in this example.script/release_checklist.py v4.7.0-rc1 to track progress. This script will also try to do some steps autonomously. It is idempotent and safe to run at any point. You can prevent it taking any actions using --dry-run.bump/v4.7.0 branch contain nightly-2024-02-29 in their lean-toolchain.git remote add nightly https://github.com/leanprover/lean4-nightly.git git fetch nightly tag nightly-2024-02-29 git checkout nightly-2024-02-29 git checkout -b releases/v4.7.0 git push --set-upstream origin releases/v4.7.0
src/CMakeLists.txt,set(LEAN_VERSION_MINOR 7) (for whichever 7 is appropriate); this should already have been updated when the development cycle began.LEAN_VERSION_IS_RELEASE line to set(LEAN_VERSION_IS_RELEASE 1) (this should be a change; on master and nightly releases it is always 0).src/CMakeLists.txt, and push.git tag v4.7.0-rc1git push origin v4.7.0-rc1-rc1 special description, and passes it to cmake using a -D option. The -rc1 doesn't need to be placed in the configuration file.https://github.com/leanprover/lean4/actions/workflows/ci.yml, looking for the v4.7.0-rc1 tag.script/release_notes.py --since v4.6.0 on the releases/v4.7.0 branch, which will report diagnostic messages on stderr (including reporting commits that it couldn't associate with a PR, and hence will be omitted) and then a chunk of markdown on stdout. See the section “Writing the release notes” below for more information.Manual/Releases/v4.7.0.lean. It's best if you update these at the same time as a you update the lean-toolchain for the reference-manual repository, see below.bump/v4.7.0 containing the required adaptations. The preparation of this branch is beyond the scope of this document.nightly-testing branch of the repository. If so, you will need to merge these into the bump_to_v4.7.0-rc1 branch manually.script/release_repos.yml,script/release_steps.py v4.7.0-rc1 <repo> (e.g. replacing <repo> with batteries), which will walk you through the following steps:master/main (as specified in the branch field), called bump_to_v4.7.0-rc1.origin/bump/v4.7.0 if relevant (i.e. bump-branch: true appears in release_repos.yml).origin/nightly-testing.verso and reference-manual development happens on nightly-testing, so we will merge that branch into bump_to_v4.7.0-rc1, but it is essential in the GitHub interface that we do a rebase merge, in order to preserve the history.lean-toolchain to leanprover/lean4:v4.7.0-rc1.lakefile.toml or lakefile.lean, if there are dependencies on nightly-testing, bump/v4.7.0, or specific version tags, update them to the new tag. If they depend on main or master, don‘t change this; you’ve just updated the dependency, so lake update will take care of modifying the manifest.lake updatelake build && if lake check-test; then lake test; fi to check things are working.chore: bump toolchain to v4.7.0-rc1 and push.verso and reference-manual you will need to do a rebase merge.)script/release_checklist.py will then create the tag v4.7.0-rc1 from master/main and push it (unless toolchain-tag: false in the release_repos.yml file)bump/v4.7.0 PRs yourself!bump/v4.8.0 branch for the next development cycle. Set the lean-toolchain file on this branch to same nightly you used for this release.script/release_checklist.py v4.7.0-rc1 one last time to check that everything is in order.v4.7.0-rc1. Please see previous announcements for suggested language. You will want a few bullet points for main topics from the release notes. Please also make sure that whoever is handling social media knows the release is out.v4.8.0) on the Lean repository, by making a PR that:dev_cycle_v4.8.src/CMakeLists.txt to say set(LEAN_VERSION_MINOR 8)Slightly longer than the corresponding steps for a stable release. Similar process, but more things go wrong. In particular, updating the downstream repositories is significantly more work (because we need to merge existing bump/v4.7.0 branches, not just update a toolchain).
bump/v4.7.0 branchesWhile not part of the release process per se, this is a brief summary of the work that goes into updating Batteries/Aesop/Mathlib to new versions.
Please read https://leanprover-community.github.io/contribute/tags_and_branches.html
nightly-testing branch that receives commits automatically from master, and has its toolchain updated automatically for every nightly. (Note: the aesop branch is not automated, and is updated on an as needed basis.) As a consequence this branch is often broken. A bot posts in the (private!) “Mathlib reviewers” stream on Zulip about the status of these branches.nightly-testing: there is no PR process.bump/v4.7.0 which accumulates reviewed changes adapting to new versions.nightly-testing is working on a given nightly, say nightly-2024-02-15, we will create a PR to bump/v4.7.0.scripts/create-adaptation-pr.sh that automates this process.bump/v4.7.0 is up to date with master (by merging master, no PR necessary)bump/v4.7.0 a bump/nightly-2024-02-15 branch.git merge nightly-testing to bring across changes from nightly-testing.bump/v4.7.0 from the bump/nightly-2024-02-15 branch.bump/v4.7.0.master -> bump/v4.7.0 -> bump/nightly-2024-02-15 -> nightly-testing. Please remember to push any merges you make to intermediate steps!Release notes content is only written for the first release candidate (-rc1). For subsequent RCs and stable releases, just update the title in the existing release notes file (see “Release notes title format” below).
The title in the #doc (Manual) line must follow these formats:
"Lean 4.7.0-rc1 (2024-03-15)" — Include the RC suffix and the release date"Lean 4.7.0-rc2 (2024-03-20)" — Update the RC number and date"Lean 4.7.0 (2024-04-01)" — Remove the RC suffix but keep the dateThe date should be the actual date when the tag was pushed (or when CI completed and created the release page).
Release notes are automatically generated from the commit history, using script/release_notes.py.
Run this as script/release_notes.py --since v4.6.0, where v4.6.0 is the previous release version. This script should be run on the releases/v4.7.0 branch. This will generate output for all commits since that tag. Note that there is output on both stderr, which should be manually reviewed, and on stdout, which should be manually copied into the reference-manual repository, in the file Manual/Releases/v4.7.0.lean.
The output on stderr should mostly be about commits for which the script could not find an associated PR, usually because a PR was rebase-merged because it contained an update to stage0. Some judgement is required here: ignore commits which look minor, but manually add items to the release notes for significant PRs that were rebase-merged.
There can also be pre-written entries in ./releases_drafts, which should be all incorporated in the release notes and then deleted from the branch.
Before adding the release notes to the reference manual, carefully review the generated markdown for these common issues:
Unterminated code blocks: PR descriptions sometimes have unclosed code fences. Look for code blocks that don't have a closing ```. If found, fetch the original PR description with gh pr view <number> and repair the code block with the complete content.
Truncated descriptions: Some PR descriptions may end abruptly mid-sentence. Review these and complete the descriptions based on the original PR.
Markdown syntax issues: Check for other markdown problems that could cause parsing errors.
The release notes go in Manual/Releases/v4_7_0.lean in the reference-manual repository.
The file structure must follow the Verso format:
/- Copyright (c) 2025 Lean FRO LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: <Your Name> -/ import VersoManual import Manual.Meta import Manual.Meta.Markdown open Manual open Verso.Genre open Verso.Genre.Manual open Verso.Genre.Manual.InlineLean #doc (Manual) "Lean 4.7.0-rc1 (2024-03-15)" => %%% tag := "release-v4.7.0" file := "v4.7.0" %%% <release notes content here>
Important formatting rules for Verso:
# for section headers inside the document, not ## (Verso uses header level 1 for subsections)``` for code blocks, not ```lean (the latter will cause Lean to execute the code)bv_decide should be wrapped in backticks: `bv_decide` (otherwise the underscore may be interpreted as markdown emphasis)After creating the release notes file, update Manual/Releases.lean to include it:
Add the import near the top with other version imports:
import Manual.Releases.«v4_7_0»
Add the include statement after the other includes:
{include 0 Manual.Releases.«v4_7_0»}
Build the release notes to check for errors:
lake build Manual.Releases.v4_7_0
Common errors and fixes:
## to #```lean to ```Important: Timing with the reference-manual tag
The reference-manual repository deploys documentation when a version tag is pushed. If you merge release notes AFTER the tag is created, the deployed documentation won't include them.
You have two options:
Preferred: Include the release notes in the same PR as the toolchain bump (or merge the release notes PR before creating the tag). This ensures the tag includes the release notes.
If release notes are merged after the tag: You must regenerate the tag to trigger a new deployment:
cd /path/to/reference-manual git fetch origin git tag -d v4.7.0-rc1 # Delete local tag git tag v4.7.0-rc1 origin/main # Create tag at current main (which has release notes) git push origin :refs/tags/v4.7.0-rc1 # Delete remote tag git push origin v4.7.0-rc1 # Push new tag (triggers Deploy workflow)
If creating a separate PR for release notes:
git checkout -b v4.7.0-release-notes git add Manual/Releases/v4_7_0.lean Manual/Releases.lean git commit -m "doc: add v4.7.0 release notes" git push -u origin v4.7.0-release-notes gh pr create --title "doc: add v4.7.0 release notes" --body "This PR adds the release notes for Lean v4.7.0."
See ./releases_drafts/README.md for more information about pre-written release note entries. See ./releases_drafts/README.md for more information.