diff --git a/.github/scripts/cargo-binstall-install.sh b/.github/scripts/cargo-binstall-install.sh index 55d90904ca3..5cbf2cda221 100755 --- a/.github/scripts/cargo-binstall-install.sh +++ b/.github/scripts/cargo-binstall-install.sh @@ -1,4 +1,9 @@ #!/usr/bin/env bash set -eu -curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash +cd $(dirname "$0") + +CARGO_BINSTALL_CHECK=$(./command-check.sh cargo-binstall) +if [ $CARGO_BINSTALL_CHECK != "true" ]; then + curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash +fi diff --git a/.github/scripts/command-check.sh b/.github/scripts/command-check.sh new file mode 100755 index 00000000000..ebe2fa52bde --- /dev/null +++ b/.github/scripts/command-check.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -eu + +command -v $1 >/dev/null 2>&1 && echo "true" || { echo >&2 "$1 is not installed" && echo "false"; } diff --git a/compiler/wasm/scripts/install_wasm-pack.sh b/compiler/wasm/scripts/install_wasm-pack.sh index b0fdffe0458..8936dd86fb7 100755 --- a/compiler/wasm/scripts/install_wasm-pack.sh +++ b/compiler/wasm/scripts/install_wasm-pack.sh @@ -3,10 +3,7 @@ set -eu cd $(dirname "$0")/.. -# Install wasm-pack -CARGO_BINSTALL_CHECK=$(./scripts/command-check.sh cargo-binstall) -if [ $CARGO_BINSTALL_CHECK != "true" ]; then - curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash -fi +../../.github/scripts/cargo-binstall-install.sh +# Install wasm-pack cargo-binstall wasm-pack@0.12.1 -y --force