@@ -32,16 +32,57 @@ runs:
3232 run : |
3333 TOIT_VERSION=${{ inputs.toit-version }}
3434
35- if [[ "$RUNNER_OS" = "Linux" ]]; then
36- TOIT_FILE=toit-linux.tar.gz
37- elif [[ "$RUNNER_OS" = "macOS" ]]; then
38- TOIT_FILE=toit-macos.tar.gz
39- elif [[ "$RUNNER_OS" = "Windows" ]]; then
40- TOIT_FILE=toit-windows.tar.gz
35+ ASSETS_NAMING_THRESHOLD_VERSION=v2.0.0-alpha.164
36+
37+ # Use sort -V to compare versions.
38+ if [[ "$TOIT_VERSION" == "latest" ]] || \
39+ [[ "$(echo -e "$ASSETS_NAMING_THRESHOLD_VERSION\n$TOIT_VERSION" | sort -V | tail -n 1)" == "$TOIT_VERSION" ]]; then
40+ if [[ "$RUNNER_OS" = "Linux" ]]; then
41+ case "$(uname -m)" in
42+ x86_64) TOIT_FILE=toit-linux-x64.tar.gz ;;
43+ armv7l) TOIT_FILE=toit-linux-armv7.tar.gz ;;
44+ aarch64) TOIT_FILE=toit-linux-aarch64.tar.gz ;;
45+ *)
46+ echo "UNSUPPORTED ARCHITECTURE: $(uname -m)"
47+ exit 1
48+ ;;
49+ esac
50+ elif [[ "$RUNNER_OS" = "macOS" ]]; then
51+ case "$(uname -m)" in
52+ x86_64) TOIT_FILE=toit-macos-x64.tar.gz ;;
53+ arm64) TOIT_FILE=toit-macos-aarch64.tar.gz ;;
54+ *)
55+ echo "UNSUPPORTED ARCHITECTURE: $(uname -m)"
56+ exit 1
57+ ;;
58+ esac
59+ elif [[ "$RUNNER_OS" = "Windows" ]]; then
60+ TOIT_FILE=toit-windows-x64.tar.gz
61+ else
62+ echo "UNSUPPORTED RUNNER: $RUNNER_OS"
63+ exit 1
64+ fi
4165 else
42- echo "UNSUPPORTED RUNNER: $RUNNER_OS"
43- exit 1
66+ if [[ "$RUNNER_OS" = "Linux" ]]; then
67+ case "$(uname -m)" in
68+ x86_64) TOIT_FILE=toit-linux.tar.gz;;
69+ armv7l) TOIT_FILE=toit-rpi.tar.gz;;
70+ aarch64) TOIT_FILE=toit-aarch64.tar.gz;;
71+ *)
72+ echo "UNSUPPORTED ARCHITECTURE: $(uname -m)"
73+ exit 1
74+ ;;
75+ esac
76+ elif [[ "$RUNNER_OS" = "macOS" ]]; then
77+ TOIT_FILE=toit-macos.tar.gz
78+ elif [[ "$RUNNER_OS" = "Windows" ]]; then
79+ TOIT_FILE=toit-windows.tar.gz
80+ else
81+ echo "UNSUPPORTED RUNNER: $RUNNER_OS"
82+ exit 1
83+ fi
4484 fi
85+
4586 echo "TOIT_FILE=$TOIT_FILE" >> $GITHUB_OUTPUT
4687
4788 if [[ $TOIT_VERSION = latest ]]; then
0 commit comments