# Latest release and LTS versions from server (for use in CI)?

**URL:** https://discourse.julialang.org/t/latest-release-and-lts-versions-from-server-for-use-in-ci/122537
**Category:** General Usage
**Created:** [November 12, 2024, 9:54am UTC](https://discourse.julialang.org/t/latest-release-and-lts-versions-from-server-for-use-in-ci/122537 "2024-11-12T09:54:40Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![t-bltg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/t-bltg/32/25526_2.png) [@t-bltg](https://discourse.julialang.org/u/t-bltg)
#### Post date: [November 12, 2024, 9:54am UTC](https://discourse.julialang.org/t/latest-release-and-lts-versions-from-server-for-use-in-ci/122537/1 "2024-11-12T09:54:40Z")

</div>

It has probably been asked before, but how can I programmatically and reliably get the **latest** stable julia version and **latest lts** stable version from an official server e.g. `julialang.org` or `julialang.net` using simple linux tools (e.g. `curl` and `grep` ?)

I don’t think the [JSON release feed](https://julialang.org/downloads/#json_release_feed) can help with that.

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [November 12, 2024, 11:23am UTC](https://discourse.julialang.org/t/latest-release-and-lts-versions-from-server-for-use-in-ci/122537/2 "2024-11-12T11:23:05Z")

</div>

Any reason not to use `juliaup`, i.e. just `juliaup add release`, `juliaup add lts`?

---

<div class="post-metadata">

### Author: ![t-bltg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/t-bltg/32/25526_2.png) [@t-bltg](https://discourse.julialang.org/u/t-bltg)
#### Post date: [November 12, 2024, 11:29am UTC](https://discourse.julialang.org/t/latest-release-and-lts-versions-from-server-for-use-in-ci/122537/3 "2024-11-12T11:29:15Z")

</div>

This is to use in ci in scripts, hence no `juliaup` available.

---

<div class="post-metadata">

### Author: ![xgdgsc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xgdgsc/32/608_2.png) [@xgdgsc](https://discourse.julialang.org/u/xgdgsc)
#### Post date: [November 12, 2024, 12:14pm UTC](https://discourse.julialang.org/t/latest-release-and-lts-versions-from-server-for-use-in-ci/122537/4 "2024-11-12T12:14:40Z")

</div>

[https://julialang-s3.julialang.org/juliaup/DBVERSION](https://julialang-s3.julialang.org/juliaup/DBVERSION) Then [julialang-s3.julialang.org/juliaup/versiondb/versiondb-1.0.55-x86\_64-unknown-linux-gnu.json](https://julialang-s3.julialang.org/juliaup/versiondb/versiondb-1.0.55-x86_64-unknown-linux-gnu.json)

---

<div class="post-metadata">

### Author: ![t-bltg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/t-bltg/32/25526_2.png) [@t-bltg](https://discourse.julialang.org/u/t-bltg)
#### Post date: [November 12, 2024, 4:47pm UTC](https://discourse.julialang.org/t/latest-release-and-lts-versions-from-server-for-use-in-ci/122537/5 "2024-11-12T16:47:20Z")

</div>

Thanks @xgdgsc.

In case it helps anyone, here is my solution:

```julia
function available_channels()
    juliaup = "https://julialang-s3.julialang.org/juliaup"
    for i ∈ 1:6
        buf = PipeBuffer()
        Downloads.download("$juliaup/DBVERSION", buf)
        dbversion = VersionNumber(readline(buf))
        dbversion.major == 1 || continue
        buf = PipeBuffer()
        Downloads.download("$juliaup/versiondb/versiondb-$dbversion-x86_64-unknown-linux-gnu.json", buf)
        json = JSON.parse(buf)
        haskey(json, "AvailableChannels") || continue
        return json["AvailableChannels"]
        sleep(10i)
    end
end

"""
julia> is_latest("lts")
julia> is_latest("release")
"""
function is_latest(variant)
    channels = available_channels()
    ver = VersionNumber(split(channels[variant]["Version"], '+') |> first)
    dev = occursin("DEV", string(VERSION)) # or length(VERSION.prerelease) < 2
    !dev && VersionNumber(ver.major, ver.minor, 0, ("",)) ≤ VERSION < VersionNumber(ver.major, ver.minor + 1)
end

################
import JSON, Downloads
@show is_latest("lts") is_latest("release")

```

EDIT: plain `julia` implementation using `Downloads`.

---

<div class="post-metadata">

### Author: ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)
#### Post date: [November 12, 2024, 7:52pm UTC](https://discourse.julialang.org/t/latest-release-and-lts-versions-from-server-for-use-in-ci/122537/6 "2024-11-12T19:52:28Z")

</div>

While this works now, I should say that we don’t treat the format of any of these files as a public API, i.e. we might change those at any point without warning as we update Juliaup.

> [@t-bltg](#):
>
> This is to use in ci in scripts, hence no `juliaup` available.

What kind of CI system? There is a GitHub action that installs Juliaup, and we also have portable versions of Juliaup available that should make it very easy to get Juliaup onto a system. So my gut feeling is that the best solution would be 1) download and extract Juliaup, 2) call `juliaup` to add whatever Julia you need.

---

<div class="post-metadata">

### Author: ![t-bltg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/t-bltg/32/25526_2.png) [@t-bltg](https://discourse.julialang.org/u/t-bltg)
#### Post date: [November 13, 2024, 6:25am UTC](https://discourse.julialang.org/t/latest-release-and-lts-versions-from-server-for-use-in-ci/122537/7 "2024-11-13T06:25:30Z")

</div>

It’s github action, but I’m not going to pull `juliaup` for a few bytes, it feels like using a hammer to kill a mosquito.

---

<div class="post-metadata">

### Author: ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)
#### Post date: [November 13, 2024, 7:25pm UTC](https://discourse.julialang.org/t/latest-release-and-lts-versions-from-server-for-use-in-ci/122537/8 "2024-11-13T19:25:08Z")

</div>

Juliaup is extremly small, less than a handful of MB. [GitHub - julia-actions/install-juliaup: GitHub Action that installs Juliaup (and uses Juliaup to install Julia)](https://github.com/julia-actions/install-juliaup) is the action to install it. I think you’ll get a _much_ more stable and reliable solution if you use it rather than fiddling with unofficial file downloads that we might change at any time…
