Ajouter action.yaml
This commit is contained in:
86
action.yaml
Normal file
86
action.yaml
Normal file
@@ -0,0 +1,86 @@
|
||||
name: 'Install container tools'
|
||||
description: 'Install docker, podman, or skopeo on the runner'
|
||||
author: 'Eric Coissac'
|
||||
|
||||
inputs:
|
||||
tools:
|
||||
description: 'Comma-separated list of tools to install (docker,podman,skopeo)'
|
||||
required: true
|
||||
debug:
|
||||
description: 'Run the action in debug mode'
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Load bash library
|
||||
uses: https://gargoton.petite-maison-orange.fr/pmo-actions/bash-library@main
|
||||
|
||||
- name: Set debug mode
|
||||
if: inputs.debug == 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
source "${{ github.action_path }}/../bashlib.sh"
|
||||
export DEBUG="ON"
|
||||
echo "DEBUG=ON" >> $GITEA_ENV
|
||||
debug Debug switch on
|
||||
|
||||
- name: Install container tools
|
||||
shell: bash
|
||||
run: |
|
||||
source "${{ github.action_path }}/../bashlib.sh"
|
||||
|
||||
# Parse la liste des outils
|
||||
IFS=',' read -r -a tools_array <<< "${{ inputs.tools }}"
|
||||
|
||||
step "Installing container tools" "${tools_array[*]}"
|
||||
|
||||
# Pour chaque outil demandé
|
||||
for tool in "${tools_array[@]}"; do
|
||||
# Enlever les espaces
|
||||
tool=$(echo "$tool" | xargs)
|
||||
|
||||
# Vérifier si déjà installé
|
||||
if command -v "$tool" >/dev/null 2>&1; then
|
||||
success "Already installed" "$tool found"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Installer l'outil
|
||||
step "Installing" "$tool"
|
||||
|
||||
case "$tool" in
|
||||
docker)
|
||||
# Docker nécessite une installation spéciale
|
||||
check_command curl
|
||||
|
||||
if curl -fsSL https://get.docker.com -o get-docker.sh && \
|
||||
sh get-docker.sh; then
|
||||
success "Success" "Docker installed"
|
||||
else
|
||||
error "Install failed" "Could not install Docker"
|
||||
fi
|
||||
rm -f get-docker.sh
|
||||
;;
|
||||
|
||||
podman|skopeo)
|
||||
check_command apt-get
|
||||
|
||||
apt-get update -qq
|
||||
|
||||
if apt-get -y install "$tool"; then
|
||||
success "Success" "$tool installed"
|
||||
else
|
||||
error "Install failed" "Could not install $tool"
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
error "Unknown tool" "$tool is not supported (docker|podman|skopeo)"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
success "Installation complete" "All requested tools installed"
|
||||
Reference in New Issue
Block a user