-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yaml
More file actions
88 lines (82 loc) · 4.23 KB
/
action.yaml
File metadata and controls
88 lines (82 loc) · 4.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# SPDX-FileCopyrightText: 2024-2025 Paul Colby <git@colby.id.au>
# SPDX-License-Identifier: MIT
name: Quick install linuxdeploy
author: Paul Colby
description: Install linuxdeploy, with optional plugins, in parrallel. Fast.
inputs:
arch:
description: Target architecture to install linuxdeploy
required: false
dir:
description: Target directory to install linuxdeploy
default: ${{ runner.temp }}/linuxdeploy
install-deps:
description: Install known OS dependencies
default: true
plugins:
description: Additional linuxdeploy plugins to install
required: false
set-env:
description: Add the installed directory to the $PATH environment variable
default: true
version:
description: Version of linuxdeploy to install
default: continuous
runs:
using: composite
steps:
- run: |
set -o errexit -o noclobber -o nounset -o pipefail
[[ "${INPUTS_INSTALL_DEPS}" = 'false' ]] || sudo apt --assume-yes install libfuse2
declare -Ar DEFAULT_ARCH=([arm]='armhf' [arm64]='aarch64' [x64]='x86_64' [x86]='i386')
declare -r ARCH="${INPUTS_ARCH:-${DEFAULT_ARCH[${RUNNER_ARCH,,}]}}"
declare -r RELEASE_FORMAT='https://github.com/%s/%s/releases/download/%%s/%s'
declare -r RAW_FORMAT='https://raw.githubusercontent.com/%s/%s/%%s/%s'
# shellcheck disable=SC2059 # We're intentionally using format strings.
declare -Ar PLUGIN_FORMAT=(
[checkrt]=$(printf "${RELEASE_FORMAT}" darealshinji linuxdeploy-plugin-checkrt{,.sh})
[conda]=$(printf "${RAW_FORMAT}" linuxdeploy linuxdeploy-plugin-conda{,.sh})
[demo]=$(printf "${RAW_FORMAT}" linuxdeploy misc-plugins 'demo/linuxdeploy-plugin-demo.sh')
[gdb]=$(printf "${RAW_FORMAT}" linuxdeploy misc-plugins 'gdb/linuxdeploy-plugin-gdb.sh')
[gettext]=$(printf "${RAW_FORMAT}" linuxdeploy misc-plugins 'gettext/linuxdeploy-plugin-gettext.sh')
[grantlee5]=$(printf "${RAW_FORMAT}" linuxdeploy misc-plugins 'grantlee5/linuxdeploy-plugin-grantlee5.sh')
[gstreamer]=$(printf "${RAW_FORMAT}" linuxdeploy linuxdeploy-plugin-gstreamer{,.sh})
[gtk]=$(printf "${RAW_FORMAT}" linuxdeploy linuxdeploy-plugin-gtk{,.sh})
[ncurses]=$(printf "${RAW_FORMAT}" linuxdeploy linuxdeploy-plugin-ncurses{,.sh})
[python]=$(printf "${RELEASE_FORMAT}" niess linuxdeploy-plugin-python{,-"${ARCH}".AppImage})
)
declare -a binaries=("${INPUTS_DIR}/linuxdeploy-${ARCH}.AppImage")
# shellcheck disable=SC2059 # We're intentionally using format strings.
declare -a urls=(
"$(printf "$(printf "${RELEASE_FORMAT}" linuxdeploy{,,-"${ARCH}".AppImage})" "${INPUTS_VERSION}")"
)
# shellcheck disable=SC2015 # If assignemnt, or `;` fail, we've got bigger issues ;)
# shellcheck disable=SC2059 # We're intentionally using format strings.
for plugin in ${INPUTS_PLUGINS}; do
IFS='@' read -r name version <<< "${plugin}"
[[ -v "PLUGIN_FORMAT[${name}]" ]] && urlFormat="${PLUGIN_FORMAT[${name}]}" || {
if [[ "${name}" == 'appimage' && "${ARCH}" == 'i386' ]]; then arch='i686'; else arch="${ARCH}"; fi
urlFormat=$(printf "${RELEASE_FORMAT}" linuxdeploy{,-plugin-"${name}"{,-"${arch}".AppImage}})
}
[[ "${urlFormat}" == 'https://raw.'* ]] && : "${version:=master}" || : "${version:=${INPUTS_VERSION}}"
printf -v url "${urlFormat}" "${version}"
binaries+=("${INPUTS_DIR}/${url##*/}")
urls+=("${url}")
done
printf "%s\n" "${urls[@]}"
curl --create-dirs --fail --fail-early --location --output-dir "${INPUTS_DIR}" --parallel --remote-name-all \
--silent --write-out '[%{urlnum}][%{http_code}] %{errormsg}: %{url}\n' "${urls[@]}"
chmod a+x "${binaries[@]}"
[[ "${INPUTS_SET_ENV}" = 'false' ]] || tee -a "${GITHUB_PATH}" <<< "${INPUTS_DIR}"
ls -l "${INPUTS_DIR}"
shell: bash
env:
INPUTS_ARCH: ${{ inputs.arch }}
INPUTS_DIR: ${{ inputs.dir }}
INPUTS_INSTALL_DEPS: ${{ inputs.install-deps }}
INPUTS_PLUGINS: ${{ inputs.plugins }}
INPUTS_SET_ENV: ${{ inputs.set-env }}
INPUTS_VERSION: ${{ inputs.version }}
branding:
color: green
icon: package