From dd4cbc4c64cc4cd023452da8c5ae286e7a521206 Mon Sep 17 00:00:00 2001 From: Kai Kuchenbecker Date: Thu, 11 Aug 2022 15:15:55 +0200 Subject: [PATCH] Add support for Heroku Stack-22. --- README.md | 1 + lib/canonical_version.sh | 37 +++++++++++++++++++++++++------------ 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 4b8cc74..234c07f 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ * Erlang - Prebuilt packages (17.5, 17.4, etc) * The full list of prebuilt packages can be found here: * gigalixir-20 or heroku-20 stacks: https://repo.hex.pm/builds/otp/ubuntu-20.04/builds.txt + * heroku-22 stacks: https://repo.hex.pm/builds/otp/ubuntu-22.04/builds.txt * All other stacks: https://github.com/HashNuke/heroku-buildpack-elixir-otp-builds/blob/master/otp-versions * Elixir - Prebuilt releases (1.0.4, 1.0.3, etc) or prebuilt branches (master, v1.7, etc) * The full list of releases can be found here: https://github.com/elixir-lang/elixir/releases diff --git a/lib/canonical_version.sh b/lib/canonical_version.sh index ad06939..c801159 100755 --- a/lib/canonical_version.sh +++ b/lib/canonical_version.sh @@ -1,11 +1,17 @@ #!/usr/bin/env bash erlang_builds_url() { - if [ "$STACK" = "heroku-20" ]; then - erlang_builds_url="https://repo.hex.pm/builds/otp/ubuntu-20.04" - else - erlang_builds_url="https://s3.amazonaws.com/heroku-buildpack-elixir/erlang/cedar-14" - fi + case "${STACK}" in + "heroku-20") + erlang_builds_url="https://repo.hex.pm/builds/otp/ubuntu-20.04" + ;; + "heroku-22") + erlang_builds_url="https://repo.hex.pm/builds/otp/ubuntu-22.04" + ;; + *) + erlang_builds_url="https://s3.amazonaws.com/heroku-buildpack-elixir/erlang/cedar-14" + ;; + esac echo $erlang_builds_url } @@ -15,13 +21,20 @@ fetch_elixir_versions() { } fetch_erlang_versions() { - if [ "$STACK" = "heroku-20" ]; then - url="https://repo.hex.pm/builds/otp/ubuntu-20.04/builds.txt" - curl -s "$url" | awk '/^OTP-([0-9.]+ )/ {print substr($1,5)}' - else - url="https://raw.githubusercontent.com/HashNuke/heroku-buildpack-elixir-otp-builds/master/otp-versions" - curl -s "$url" - fi + case "${STACK}" in + "heroku-20") + url="https://repo.hex.pm/builds/otp/ubuntu-20.04/builds.txt" + curl -s "$url" | awk '/^OTP-([0-9.]+ )/ {print substr($1,5)}' + ;; + "heroku-22") + url="https://repo.hex.pm/builds/otp/ubuntu-22.04/builds.txt" + curl -s "$url" | awk '/^OTP-([0-9.]+ )/ {print substr($1,5)}' + ;; + *) + url="https://raw.githubusercontent.com/HashNuke/heroku-buildpack-elixir-otp-builds/master/otp-versions" + curl -s "$url" + ;; + esac } exact_erlang_version_available() {