# How can a script determine the latest Julia version and latest pre-release in CI?

**URL:** https://discourse.julialang.org/t/how-can-a-script-determine-the-latest-julia-version-and-latest-pre-release-in-ci/127446
**Category:** General Usage
**Tags:** question, ci
**Created:** [March 28, 2025, 10:22am UTC](https://discourse.julialang.org/t/how-can-a-script-determine-the-latest-julia-version-and-latest-pre-release-in-ci/127446 "2025-03-28T10:22:02Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [March 28, 2025, 10:22am UTC](https://discourse.julialang.org/t/how-can-a-script-determine-the-latest-julia-version-and-latest-pre-release-in-ci/127446/1 "2025-03-28T10:22:02Z")

</div>

How can I determine:

- the latest stable Julia version
- the latest Julia release
- the latest Julia pre-release

on github?

I can do:

```julia
ufechner@ufryzen:~$ juliaup list | grep release
 release 1.11.4+0.x64.linux.gnu          
 release~x64 1.11.4+0.x64.linux.gnu          
 release~x86 1.11.4+0.x86.linux.gnu     

```

which is already nice, but I don’t have the version number string yet.

I cannot do:

```julia
juliaup list | grep pre

```

This gives me only version 0.6 as pre-release.

---

<div class="post-metadata">

### Author: ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)
#### Post date: [March 28, 2025, 11:42am UTC](https://discourse.julialang.org/t/how-can-a-script-determine-the-latest-julia-version-and-latest-pre-release-in-ci/127446/2 "2025-03-28T11:42:43Z")

</div>

Does this help?

> **[GitHub - julia-actions/setup-julia: This action sets up a Julia environment for use in...](https://github.com/julia-actions/setup-julia?tab=readme-ov-file#julia-versions)**
>
> This action sets up a Julia environment for use in actions by downloading a specified version of Julia and adding it to PATH.

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [March 28, 2025, 11:56am UTC](https://discourse.julialang.org/t/how-can-a-script-determine-the-latest-julia-version-and-latest-pre-release-in-ci/127446/3 "2025-03-28T11:56:33Z")

</div>

Thanks for the link. Unfortunately it doesn’t solve my problem. I want to test with the latest release and the latest pre-release, but often both are the same, and then I don’t want to run the same job twice.

So I need to test if the pre-release is the same as the release. There is no job yet that can do that, so I have to program that myself. But I can program that only if I found a reliable way to determine the version number both of the latest release and of the latest pre-release.

---

<div class="post-metadata">

### Author: ![GHTaarn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ghtaarn/32/216007_2.png) [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)
#### Post date: [March 28, 2025, 1:27pm UTC](https://discourse.julialang.org/t/how-can-a-script-determine-the-latest-julia-version-and-latest-pre-release-in-ci/127446/4 "2025-03-28T13:27:23Z")

</div>

does this help?

[https://julialang-s3.julialang.org/bin/versions.json](https://julialang-s3.julialang.org/bin/versions.json)

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [March 28, 2025, 1:31pm UTC](https://discourse.julialang.org/t/how-can-a-script-determine-the-latest-julia-version-and-latest-pre-release-in-ci/127446/5 "2025-03-28T13:31:22Z")

</div>

Not really. I do not know how to extract the version number of the latest Julia version and the latest pre release from the .json file.

Perplexity suggested:

```julia
echo "latest=$(jq -r '.latest.version' <<< "$versions")"

```

which does not work, the result is empty.

---

<div class="post-metadata">

### Author: ![GHTaarn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ghtaarn/32/216007_2.png) [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)
#### Post date: [March 28, 2025, 4:04pm UTC](https://discourse.julialang.org/t/how-can-a-script-determine-the-latest-julia-version-and-latest-pre-release-in-ci/127446/6 "2025-03-28T16:04:08Z")

</div>

This seems to work right now:

```julia
using Downloads, JSON
j = Downloads.download("https://julialang-s3.julialang.org/bin/versions.json", IOBuffer()) |> seekstart |> JSON.parse
lateststable = (keys(j) |> filter(contains(r"^[0-9]+\.[0-9]+\.[0-9]+$")) .|> VersionNumber |> sort)[end]
latestpre = (keys(j) |> filter(contains(r"^[0-9]+\.[0-9]+\.[0-9]+-")) .|> VersionNumber |> sort)[end]

```
