Files
install-action/action.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

70 lines
2.6 KiB
YAML
Raw Normal View History

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:
description: Whether to enable checksums
required: false
default: 'true'
fallback:
description: Whether to use fallback (none, cargo-binstall, cargo-install)
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
shell: sh
2025-07-06 11:36:56 +09:00
if: runner.os == 'Linux'
- run: bash --noprofile --norc "${GITHUB_ACTION_PATH:?}/main.sh"
shell: bash
env:
# NB: Sync with non-Windows case.
INPUT_TOOL: ${{ inputs.tool }}
INPUT_CHECKSUM: ${{ inputs.checksum }}
INPUT_FALLBACK: ${{ inputs.fallback }}
DEFAULT_GITHUB_TOKEN: ${{ github.token }}
ACTION_USER_AGENT: ${{ github.action_repository }} (${{ github.action_ref }})
if: runner.os != 'Windows'
# Workaround for https://github.com/actions/partner-runner-images/issues/169
# TODO: Is it necessary to retry for main.sh call? Or is this sufficient? https://github.com/taiki-e/install-action/pull/1647
- run: |
Set-StrictMode -Version Latest
$action_path = $env:GITHUB_ACTION_PATH
& bash --noprofile --norc "${action_path}/main.sh"
shell: pwsh
env:
# NB: Sync with non-Windows case.
INPUT_TOOL: ${{ inputs.tool }}
INPUT_CHECKSUM: ${{ inputs.checksum }}
INPUT_FALLBACK: ${{ inputs.fallback }}
DEFAULT_GITHUB_TOKEN: ${{ github.token }}
ACTION_USER_AGENT: ${{ github.action_repository }} (${{ github.action_ref }})
if: runner.os == 'Windows'