mirror of
https://github.com/morluto/rea.git
synced 2026-11-21 06:04:03 +00:00
38 lines
1.5 KiB
YAML
38 lines
1.5 KiB
YAML
name: Install hosted Ubuntu packages
|
|
description: Download fixture prerequisites within a deadline, then install from the local APT cache.
|
|
inputs:
|
|
packages:
|
|
description: Space-separated package names from the already selected signed sources.
|
|
required: true
|
|
download-timeout-seconds:
|
|
description: Outer download deadline in seconds, before the five-second termination grace.
|
|
default: "180"
|
|
install-recommends:
|
|
description: Leave APT's recommendation policy in effect when true.
|
|
default: "true"
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- shell: bash
|
|
env:
|
|
REA_APT_PACKAGES: ${{ inputs.packages }}
|
|
REA_APT_DOWNLOAD_TIMEOUT: ${{ inputs.download-timeout-seconds }}
|
|
REA_APT_INSTALL_RECOMMENDS: ${{ inputs.install-recommends }}
|
|
run: |
|
|
read -r -a packages <<< "$REA_APT_PACKAGES"
|
|
if (( ${#packages[@]} == 0 )); then
|
|
echo '::error::No hosted Ubuntu packages were supplied'
|
|
exit 1
|
|
fi
|
|
options=(--yes)
|
|
if [[ "$REA_APT_INSTALL_RECOMMENDS" == 'false' ]]; then
|
|
options+=(--no-install-recommends)
|
|
fi
|
|
sudo timeout --kill-after=5s "${REA_APT_DOWNLOAD_TIMEOUT}s" \
|
|
apt-get -o Acquire::Retries=2 --download-only install "${options[@]}" -- "${packages[@]}" || {
|
|
status=$?
|
|
echo "::error::APT package download failed (exit ${status})"
|
|
exit "$status"
|
|
}
|
|
sudo apt-get --no-download install "${options[@]}" -- "${packages[@]}"
|