mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-16 07:36:38 +00:00
Fix installer downloads for specific releases
Github download urls for a specific release uses the pattern `../releases/download/[RELEASE]/..`, which differs from the latest release URL which uses `../releases/latest/download/..`. For convenience, if `BINSTALL_VERSION` is set but doesn't start with `v`, the v is prefixed.
This commit is contained in:
parent
2417642284
commit
7b32f7cc25
2 changed files with 24 additions and 5 deletions
|
@ -2,11 +2,21 @@
|
|||
|
||||
set -euxo pipefail
|
||||
|
||||
BINSTALL_VERSION="${BINSTALL_VERSION:-latest}"
|
||||
if [[ -n "${BINSTALL_VERSION:-}" && "$BINSTALL_VERSION" != v* ]]; then
|
||||
# prefix version with v
|
||||
BINSTALL_VERSION="v$BINSTALL_VERSION"
|
||||
fi
|
||||
|
||||
cd "$(mktemp -d)"
|
||||
|
||||
base_url="https://github.com/cargo-bins/cargo-binstall/releases/${BINSTALL_VERSION}/download/cargo-binstall-"
|
||||
# Fetch binaries from `[..]/releases/latest/download/[..]` if _no_ version is
|
||||
# given, otherwise from `[..]/releases/download/VERSION/[..]`. Note the shifted
|
||||
# location of '/download'.
|
||||
if [[ -z "${BINSTALL_VERSION:-}" ]]; then
|
||||
base_url="https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-"
|
||||
else
|
||||
base_url="https://github.com/cargo-bins/cargo-binstall/releases/download/${BINSTALL_VERSION}/cargo-binstall-"
|
||||
fi
|
||||
|
||||
os="$(uname -s)"
|
||||
if [ "$os" == "Darwin" ]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue