From a07a0a7960151fa285cf2f1c6a3632f5f2944f4d Mon Sep 17 00:00:00 2001 From: Rafal Chlodnicki Date: Sat, 26 Sep 2026 19:05:11 +0200 Subject: [PATCH] auto-detect arm64 in github action --- .github/workflows/test.yaml | 3 +++ actions/setup/action.yaml | 8 +++++--- actions/setup/install_sublime_text.ps1 | 5 +++++ actions/setup/install_sublime_text.sh | 9 ++++++--- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4989459b..f36ed334 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -24,6 +24,9 @@ jobs: matrix: st-version: [3, 4] os: ["ubuntu-latest", "macOS-latest", "windows-latest"] + include: + - st-version: 4 + os: "ubuntu-26.04-arm" runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v6 diff --git a/actions/setup/action.yaml b/actions/setup/action.yaml index ae1040d5..800d11ee 100644 --- a/actions/setup/action.yaml +++ b/actions/setup/action.yaml @@ -9,9 +9,11 @@ inputs: required: true default: 4 sublime-text-arch: - description: Sublime Text Version Arch. It could be x32 for Sublime Text 3. - required: true - default: x64 + description: >- + Sublime Text build architecture: x64, arm64 (Linux, Sublime Text 4) or x32 (Sublime Text 3). + Detected from the runner if empty. + required: false + default: '' install-package: description: Whether to install the checked out package. required: true diff --git a/actions/setup/install_sublime_text.ps1 b/actions/setup/install_sublime_text.ps1 index 6b491121..3086a900 100644 --- a/actions/setup/install_sublime_text.ps1 +++ b/actions/setup/install_sublime_text.ps1 @@ -9,6 +9,11 @@ param( $ErrorActionPreference = 'stop' +# Sublime Text has no Windows arm64 build; x64 runs under emulation there. +if (-not $Arch) { + $Arch = 'x64' +} + $private:MaxRetries = 20 if ($Version -ge 4) { $private:SublimeTextUrl = "http://www.sublimetext.com/download_thanks" diff --git a/actions/setup/install_sublime_text.sh b/actions/setup/install_sublime_text.sh index f2086e67..c75c3919 100644 --- a/actions/setup/install_sublime_text.sh +++ b/actions/setup/install_sublime_text.sh @@ -28,10 +28,13 @@ if [ -z $SUBLIME_TEXT_VERSION ]; then fi if [ -z $SUBLIME_TEXT_ARCH ]; then - SUBLIME_TEXT_ARCH=x64 + case "$(uname -m)" in + aarch64|arm64) SUBLIME_TEXT_ARCH=arm64 ;; + *) SUBLIME_TEXT_ARCH=x64 ;; + esac fi -if [ $SUBLIME_TEXT_VERSION -ge 4 ] && [ "$SUBLIME_TEXT_ARCH" != "x64" ]; then +if [ $SUBLIME_TEXT_VERSION -ge 4 ] && [ "$SUBLIME_TEXT_ARCH" != "x64" ] && [ "$SUBLIME_TEXT_ARCH" != "arm64" ]; then echo "wrong value of $SUBLIME_TEXT_ARCH for Sublime Text version $SUBLIME_TEXT_VERSION" exit 1 fi @@ -126,7 +129,7 @@ else echo "installing sublime text $SUBLIME_TEXT_VERSION" for i in {1..20}; do if [ $SUBLIME_TEXT_VERSION -ge 4 ]; then - URL=$(curl -s "$STWEB" | sed -n 's/.*href="\([^"]*_x64\.tar\.xz\)".*/\1/p') + URL=$(curl -s "$STWEB" | sed -n "s/.*href=\"\([^\"]*_${SUBLIME_TEXT_ARCH}\.tar\.xz\)\".*/\1/p") else if [ "$SUBLIME_TEXT_ARCH" = "x64" ]; then URL=$(curl -s "$STWEB" | sed -n 's/.*href="\([^"]*x64\.tar\.bz2\)".*/\1/p')