Skip to content

Commit 79d95d8

Browse files
authored
Merge pull request #26 from blackliner/arm-support
Add support for arm64
2 parents c220f3e + 2a35f9f commit 79d95d8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

mr.bash

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,16 +224,24 @@ function mr::pat2token {
224224
# $?: 0 if successful and non-zero otherwise
225225
# stdout: local path of downloaded file
226226
function mr::downloadRunner {
227-
local url="$MR_RELEASE_URL" tarpath=''
227+
local url="$MR_RELEASE_URL" tarpath='' arch=''
228228

229229
if [[ -z "$url" ]]; then
230230
run::exists jq || return $?
231+
232+
# Detect architecture
233+
case "$(uname -m)" in
234+
x86_64) arch="x64" ;;
235+
aarch64|arm64) arch="arm64" ;;
236+
*) log::_ ERROR "Unsupported architecture: $(uname -m)" && return 1 ;;
237+
esac
238+
231239
curlArgs=(-Lsm 3 --retry 1)
232240
# https://github.com/vbem/multi-runners/pull/16
233241
[[ -n "$MR_GITHUB_PAT" ]] && curlArgs+=('-H' "Authorization: Bearer ${MR_GITHUB_PAT}")
234242
url="$(
235243
curl "${curlArgs[@]}" https://api.github.com/repos/actions/runner/releases/latest \
236-
| jq -Mcre '.assets[].browser_download_url|select(test("linux-x64-[^-]+\\.tar\\.gz"))'
244+
| jq -Mcre ".assets[].browser_download_url|select(test(\"linux-${arch}-[^-]+\\\\.tar\\\\.gz\"))"
237245
)" || log::failed $? "Fetching latest version number failed, check PAT or rate limit!" || return $?
238246
fi
239247

0 commit comments

Comments
 (0)