Skip to content

Commit

Permalink
Add support for installing nightlies
Browse files Browse the repository at this point in the history
  • Loading branch information
szymmis committed Aug 11, 2023
1 parent ae7b5b7 commit 4f59029
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -euo pipefail

GH_REPO="https://github.com/software-mansion/scarb"
GH_NIGHTLIES_REPO="https://github.com/software-mansion/scarb-nightlies"
TOOL_NAME="scarb"
TOOL_TEST="scarb --version"

Expand Down Expand Up @@ -42,8 +43,18 @@ download_release() {
get_architecture || fail "Could not determine system architecture."
local _arch="$RETVAL"

local _tarball="scarb-v${version}-${_arch}.tar.gz"
url="$GH_REPO/releases/download/v${version}/${_tarball}"
local repository tag

if grep -q "nightly" <<<"$version"; then
repository=$GH_NIGHTLIES_REPO
tag=$version
else
repository=$GH_REPO
tag="v$version"
fi

local _tarball="scarb-${tag}-${_arch}.tar.gz"
url="${repository}/releases/download/${tag}/${_tarball}"

echo "* Downloading $TOOL_NAME release $version..."
curl "${curl_opts[@]}" -o "$filename" -C - "$url" || fail "Could not download $url"
Expand Down

0 comments on commit 4f59029

Please sign in to comment.