rust/update.sh
kemitix 5b2365e925
All checks were successful
/ test (map[name:nightly]) (push) Successful in 1m29s
/ test (map[name:stable]) (push) Successful in 1m7s
/ test (map[name:v1.81.0]) (push) Successful in 1m37s
build: build and publish image nightly
Removes need to update toolchain for every action step
2025-01-10 20:12:18 +00:00

32 lines
740 B
Bash
Executable file

#!/usr/bin/env bash
set -e
echo "INPUT_ARGS: ${INPUT_ARGS}"
# split input into an array
read -ra ARGS <<<"${INPUT_ARGS}"
# default toolchain
TOOLCHAIN="stable"
echo "Default toolchain: ${TOOLCHAIN}"
# if first parameter is 'nightly'...
if test "${ARGS[0]}" == "nightly"; then
TOOLCHAIN="nightly"
ARGS=("${ARGS[@]:1}")
fi
if test "${ARGS[0]}" == "stable"; then
TOOLCHAIN="stable" # redundant as this is the default
ARGS=("${ARGS[@]:1}")
fi
if [[ "${ARGS[0]}" == v1* ]]; then
TOOLCHAIN="${ARGS[0]:1}"
ARGS=("${ARGS[@]:1}")
fi
echo "Selected toolchain: ${TOOLCHAIN}"
echo ">>> Update toolchain"
rustup update "${TOOLCHAIN}"
echo ">>> Install rustfmt and clippy"
rustup component add --toolchain "${TOOLCHAIN}" rustfmt clippy