Skip to content

Commit 7163515

Browse files
committed
Auto-detect the target architecture
Squashed commit of the following: commit e4edcbf Author: Paul Colby <[email protected]> Date: Sun Oct 20 21:54:24 2024 +1100 Remove test-arch job Because the $RUNNER_ARCH variable cannot be overridden (even for testing). commit 87d9a2f Author: Paul Colby <[email protected]> Date: Sun Oct 20 21:46:43 2024 +1100 Auto-detect the target architecture
1 parent 6822c31 commit 7163515

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [1.0.1][] (2024-10-20)
4+
5+
Match host runner's architecture by default.
6+
37
## [1.0.0][] (2024-10-20)
48

59
Initial public release, with full support for installing [linuxdeploy], and the following optional plugins:
@@ -14,6 +18,7 @@ Initial public release, with full support for installing [linuxdeploy], and the
1418
- `python`
1519
- `qt`
1620

21+
[1.0.1]: https://github.com/pcolby/install-linuxdeploy-action/releases/tag/v1.0.1
1722
[1.0.0]: https://github.com/pcolby/install-linuxdeploy-action/releases/tag/v1.0.0
1823

1924
[linuxdeploy]: https://github.com/linuxdeploy/linuxdeploy

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ GitHub Action for installing [linuxdeploy] with optional plugins.
1616
### `arch`
1717

1818
The target architecture to install [linuxdeploy] for. This can be any architecture that [linuxdeploy] releases binaries
19-
for, but typically you'd want to leave it to default to `x86_64`.
19+
for. Defaults to match the architecture of the current workflow runner (typically `x86_64`).
2020

2121
### `dir`
2222

action.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ description: Install linuxdeploy, with optional plugins, in parrallel. Fast.
1010
inputs:
1111
arch:
1212
description: Target architecture to install linuxdeploy
13-
default: x86_64
13+
required: false
1414
dir:
1515
description: Target directory to install linuxdeploy
1616
default: ${{ runner.temp }}/linuxdeploy
@@ -33,6 +33,8 @@ runs:
3333
- run: |
3434
set -o errexit -o noclobber -o nounset -o pipefail
3535
[[ "${INPUTS_INSTALL_DEPS}" = 'false' ]] || sudo apt --assume-yes install libfuse2
36+
declare -Ar DEFAULT_ARCH=([arm]='armhf' [arm64]='aarch64' [x64]='x86_64' [x86]='i386')
37+
declare -r ARCH="${INPUTS_ARCH:-${DEFAULT_ARCH[${RUNNER_ARCH,,}]}}"
3638
declare -r RELEASE_FORMAT='https://github.com/%s/%s/releases/download/%%s/%s'
3739
declare -r RAW_FORMAT='https://raw.githubusercontent.com/%s/%s/%%s/%s'
3840
declare -Ar PLUGIN_FORMAT=(
@@ -41,16 +43,16 @@ runs:
4143
[gstreamer]=$(printf "${RAW_FORMAT}" linuxdeploy linuxdeploy-plugin-gstreamer{,.sh})
4244
[gtk]=$(printf "${RAW_FORMAT}" linuxdeploy linuxdeploy-plugin-gtk{,.sh})
4345
[ncurses]=$(printf "${RAW_FORMAT}" linuxdeploy linuxdeploy-plugin-ncurses{,.sh})
44-
[python]=$(printf "${RELEASE_FORMAT}" niess linuxdeploy-plugin-python{,-${INPUTS_ARCH}.AppImage})
46+
[python]=$(printf "${RELEASE_FORMAT}" niess linuxdeploy-plugin-python{,-${ARCH}.AppImage})
4547
)
46-
declare -a binaries=("${INPUTS_DIR}/linuxdeploy-${INPUTS_ARCH}.AppImage")
48+
declare -a binaries=("${INPUTS_DIR}/linuxdeploy-${ARCH}.AppImage")
4749
declare -a urls=(
48-
$(printf "$(printf "${RELEASE_FORMAT}" linuxdeploy{,,-${INPUTS_ARCH}.AppImage})" "${INPUTS_VERSION}")
50+
$(printf "$(printf "${RELEASE_FORMAT}" linuxdeploy{,,-${ARCH}.AppImage})" "${INPUTS_VERSION}")
4951
)
5052
for plugin in ${INPUTS_PLUGINS}; do
5153
IFS='@' read -r name version <<< "${plugin}"
5254
[[ -v "PLUGIN_FORMAT[${name}]" ]] && urlFormat="${PLUGIN_FORMAT[${name}]}" ||
53-
urlFormat=$(printf "${RELEASE_FORMAT}" linuxdeploy{,-plugin-${name}{,-${INPUTS_ARCH}.AppImage}})
55+
urlFormat=$(printf "${RELEASE_FORMAT}" linuxdeploy{,-plugin-${name}{,-${ARCH}.AppImage}})
5456
[[ "${urlFormat}" == 'https://raw.'* ]] && : "${version:=master}" || : "${version:=${INPUTS_VERSION}}"
5557
printf -v url "${urlFormat}" "${version}"
5658
binaries+=("${INPUTS_DIR}/${url##*/}")

0 commit comments

Comments
 (0)