From f4a5b186b7de8b67fc8bf90a4399fd142d503799 Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Fri, 26 Dec 2025 15:06:31 +0100 Subject: [PATCH] Ajouter action.yaml --- action.yaml | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 action.yaml diff --git a/action.yaml b/action.yaml new file mode 100644 index 0000000..25712e7 --- /dev/null +++ b/action.yaml @@ -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" \ No newline at end of file