2021-12-30 17:33:20 +09:00
name : Install development tools
description : GitHub Action for installing development tools
inputs :
tool :
2025-12-30 17:53:10 +09:00
description : Tools to install (whitespace or comma separated list)
2021-12-30 17:33:20 +09:00
required : true
# default: #publish:tool
2022-12-24 21:49:18 +09:00
checksum :
2026-04-04 22:20:07 +09:00
description : Whether to enable checksums (strongly discouraged to disable)
2022-12-24 21:49:18 +09:00
required : false
default : 'true'
2024-06-08 16:33:32 +09:00
fallback :
2025-09-08 00:22:36 +09:00
description : Whether to use fallback (none, cargo-binstall, cargo-install)
2024-06-08 16:33:32 +09:00
required : false
default : 'cargo-binstall'
2021-12-30 17:33:20 +09:00
2023-01-16 20:34:02 +09:00
# Note:
# - inputs.* should be manually mapped to INPUT_* due to https://github.com/actions/runner/issues/665
# - Use GITHUB_*/RUNNER_* instead of github.*/runner.* due to https://github.com/actions/runner/issues/2185
2021-12-30 17:33:20 +09:00
runs :
2023-01-16 20:34:02 +09:00
using : composite
steps :
2024-07-16 00:11:38 +09:00
- run : |
set -eu
if ! command -v bash >/dev/null; then
if grep -Eq '^ID=alpine' /etc/os-release; then
2024-08-12 04:27:46 +09:00
printf '::group::Install packages required for install-action (bash)\n'
2024-07-16 00:11:38 +09:00
# NB: sync with apk_install in main.sh
if command -v sudo >/dev/null; then
sudo apk --no-cache add bash
elif command -v doas >/dev/null; then
doas apk --no-cache add bash
else
apk --no-cache add bash
fi
printf '::endgroup::\n'
else
2024-08-12 04:27:46 +09:00
printf '::error::install-action requires bash\n'
2024-07-16 00:11:38 +09:00
exit 1
fi
fi
2026-04-04 12:14:05 +09:00
bash --noprofile --norc "${GITHUB_ACTION_PATH:?}/main.sh"
2024-07-16 00:11:38 +09:00
shell : sh
2024-09-28 16:20:03 +09:00
env :
2026-04-03 04:20:46 +09:00
# NB: Sync with Windows case.
2024-09-28 16:20:03 +09:00
INPUT_TOOL : ${{ inputs.tool }}
INPUT_CHECKSUM : ${{ inputs.checksum }}
INPUT_FALLBACK : ${{ inputs.fallback }}
2026-04-10 02:37:36 +09:00
DEFAULT_GITHUB_TOKEN : ${{ inputs.fallback == 'cargo-binstall' && github.token || '' }}
2025-06-18 22:55:40 +09:00
ACTION_USER_AGENT : ${{ github.action_repository }} (${{ github.action_ref }})
2026-04-01 23:50:23 +09:00
if : runner.os != 'Windows'
2026-04-03 04:20:46 +09:00
# Use pwsh and retry on bash startup failure to work around windows-11-arm runner bug:
# https://github.com/actions/partner-runner-images/issues/169
2026-04-01 23:50:23 +09:00
- run : |
Set-StrictMode -Version Latest
2026-04-02 20:36:38 +09:00
for ($i=1; $i -le 10; $i++) {
$prev_err_action = $ErrorActionPreference
$ErrorActionPreference = "Continue"
& bash --noprofile --norc "$env:GITHUB_ACTION_PATH/main.sh"
$code = $LASTEXITCODE
$ErrorActionPreference = "$prev_err_action"
if (Test-Path "$env:USERPROFILE\.install-action\init") {
# If bash started successfully, main.sh creates init file.
Remove-Item "$env:USERPROFILE\.install-action\init" -Force
exit $code
}
if ($i -lt 10) {
Write-Output "::warning::installation failed due to bash startup failure (<https://github.com/actions/partner-runner-images/issues/169>); retrying..."
}
}
Write-Output "::error::installation failed due to bash startup failure (<https://github.com/actions/partner-runner-images/issues/169>); this maybe resolved by re-running job"
exit 1
2026-04-02 09:28:57 +09:00
shell : pwsh
2026-04-01 23:50:23 +09:00
env :
# NB: Sync with non-Windows case.
INPUT_TOOL : ${{ inputs.tool }}
INPUT_CHECKSUM : ${{ inputs.checksum }}
INPUT_FALLBACK : ${{ inputs.fallback }}
2026-04-10 02:37:36 +09:00
DEFAULT_GITHUB_TOKEN : ${{ inputs.fallback == 'cargo-binstall' && github.token || '' }}
2026-04-01 23:50:23 +09:00
ACTION_USER_AGENT : ${{ github.action_repository }} (${{ github.action_ref }})
if : runner.os == 'Windows'