Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added latest-stable script #137

Merged
merged 4 commits into from
Mar 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions bin/latest-stable
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

# calling a script to list all elixir releases
# reject releases before 1.0.0 (starting with 0)
# reject main and master branches
# reject releases with otp version
# reject release candidates
# reject empty line
# finally take last one
ASDF_ELIXIR_LATEST_VERSION=$(./list-all | grep -Pv "^0|^main|^master|otp|rc|^$" | tail -n 1)

# gets current erlang version without headers
# changes spaces to new line
# takes second line (Name Version Source Installed)
ASDF_ELIXIR_LATEST_OTP=$(asdf current --no-header erlang | tr -s " " "\n" | sed -n 2p)

# Note: asdf latest does not allows latest stable version to start with number
# therefore installing from source by git ref is not supported, see:
# https://github.com/asdf-vm/asdf/blob/v0.16.5/internal/versions/versions.go#L276
echo "$ASDF_ELIXIR_LATEST_VERSION-otp-$ASDF_ELIXIR_LATEST_OTP"