Files
Actions/install-opencode/action.yml

42 lines
1.1 KiB
YAML

name: Installa OpenCode
description: Installa opencode-ai globalmente tramite npm.
inputs:
version:
description: Versione di opencode da installare (default: latest).
required: false
default: ""
runs:
using: composite
steps:
- name: Verifica prerequisiti
shell: bash
run: |
set -euo pipefail
if ! command -v node &> /dev/null; then
echo "ERRORE: node non trovato. Installa Node.js sul runner."
exit 1
fi
if ! command -v npm &> /dev/null; then
echo "ERRORE: npm non trovato."
exit 1
fi
echo "node $(node --version), npm $(npm --version)"
- name: Installa opencode
shell: bash
run: |
set -euo pipefail
if command -v opencode &> /dev/null; then
echo "opencode già installato: $(opencode --version)"
exit 0
fi
VERSION="${{ inputs.version }}"
if [ -n "$VERSION" ]; then
npm install -g "opencode-ai@${VERSION}"
else
npm install -g opencode-ai
fi
echo "opencode installato: $(opencode --version)"