Zulip Chat Archive
Stream: Is there code for X?
Topic: How to get latest (pre)release of Lean
Asei Inoue (Aug 02 2024 at 11:22):
I want to get latest (pre)release of Lean as String. (ex. v4.9.1, v4.10.0-rc2, ...)
This is for lean-update action.
I used to implement this as follows:
LATEST_LEAN=$(gh release list --repo leanprover/lean4 --limit 1 | awk '{print $1}')
echo "The latest release/prerelase is: $LATEST_LEAN"
echo "leanprover/lean4:$LATEST_LEAN" > lean-toolchain
almost always this works, but this sometimese fails.
For example, at Jul 11, this script would get v4.9.1
as the latest release, but actually the latest was v4.10.0-rc2
.
see : https://github.com/oliver-butterley/lean-update/issues/26
Is there an easy way to get the latest release?
Kim Morrison (Aug 02 2024 at 22:51):
I don't know of a way to ask Github, besides getting the whole list, parsing the version identifiers, sorting them (appropriately!), and taking the last one.
Kim Morrison (Aug 02 2024 at 22:51):
Someone should write a tiny semver library in Lean!
Joachim Breitner (Aug 03 2024 at 00:22):
You mean https://github.com/leanprover/release-index and https://release.lean-lang.org/stable.json etc?
Joachim Breitner (Aug 03 2024 at 00:23):
(I guess you still need to sort them.)
Yury G. Kudryashov (Aug 03 2024 at 01:47):
gh
can return all releases, but it sorts them by date, not by version number.
Asei Inoue (Aug 03 2024 at 15:31):
I made a simple lib for this.
https://github.com/Seasawher/Semver.lean
Last updated: May 02 2025 at 03:31 UTC