Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 25d18686e4 | |||
| 9362771f7c | |||
| ba7d7066c0 | |||
| eca0284dac | |||
| 153f48a394 | |||
| fe367f4b04 | |||
| dc36dd2eef | |||
| 1f366d5d70 | |||
| 9c7bad351d | |||
| 8eedb63290 | |||
| af7a24fcf2 |
@@ -0,0 +1,23 @@
|
|||||||
|
name: Deploy via Script Externo
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
workflow_dispatch: # Permite executar manualmente
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 📥 Baixar código
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 🔧 Configurar permissões
|
||||||
|
run: chmod +x scripts/*.sh
|
||||||
|
|
||||||
|
- name: 🚀 Executar deploy
|
||||||
|
run: ./scripts/deploy.sh
|
||||||
|
env:
|
||||||
|
DEPLOY_ENV: production
|
||||||
|
TIMESTAMP: $(date +%s)
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
name: ShellCheck CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main, feature/* ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
shellcheck:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Run ShellCheck
|
||||||
|
uses: ludeeus/action-shellcheck@master
|
||||||
|
with:
|
||||||
|
severity: warning
|
||||||
|
ignore_paths: logs
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
name: Teste Shell Runner
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
shell-test:
|
||||||
|
runs-on: deploy
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: ✅ Verificar sistema
|
||||||
|
run: |
|
||||||
|
echo "=== Runner funcionando! ==="
|
||||||
|
echo "Data: $(date)"
|
||||||
|
echo "Hostname: $(hostname)"
|
||||||
|
uname -a
|
||||||
|
|
||||||
|
- name: 📦 Verificar ferramentas disponíveis
|
||||||
|
run: |
|
||||||
|
echo "=== Sistema base ==="
|
||||||
|
cat /etc/os-release
|
||||||
|
echo ""
|
||||||
|
echo "=== Ferramentas disponíveis ==="
|
||||||
|
which bash && bash --version | head -1
|
||||||
|
which curl && curl --version | head -1
|
||||||
|
which wget && wget --version 2>&1 | head -1 || echo "wget: não instalado"
|
||||||
|
which git && git --version
|
||||||
|
|
||||||
|
- name: 📦 Instalar python3 se necessário
|
||||||
|
run: |
|
||||||
|
# Alpine usa apk, Ubuntu/Debian usa apt
|
||||||
|
if command -v apk &>/dev/null; then
|
||||||
|
apk add --no-cache python3
|
||||||
|
elif command -v apt-get &>/dev/null; then
|
||||||
|
apt-get update -qq && apt-get install -y -qq python3
|
||||||
|
fi
|
||||||
|
python3 --version
|
||||||
|
- name: 🌐 Testar conectividade externa
|
||||||
|
run: |
|
||||||
|
echo "=== Ping externo ==="
|
||||||
|
curl -s https://ifconfig.me && echo ""
|
||||||
|
echo "Conectividade OK!"
|
||||||
|
|
||||||
|
- name: 📝 Criar e executar script shell inline
|
||||||
|
run: |
|
||||||
|
cat > /tmp/meu-script.sh << 'EOF'
|
||||||
|
#!/bin/bash
|
||||||
|
echo "=== Script a correr dentro do runner ==="
|
||||||
|
echo "Utilizador: $(whoami)"
|
||||||
|
echo "Directório: $(pwd)"
|
||||||
|
echo "Memória disponível:"
|
||||||
|
free -h
|
||||||
|
echo "Espaço em disco:"
|
||||||
|
df -h /
|
||||||
|
EOF
|
||||||
|
|
||||||
|
chmod +x /tmp/meu-script.sh
|
||||||
|
bash /tmp/meu-script.sh
|
||||||
|
|
||||||
|
- name: 🎉 Teste concluído
|
||||||
|
run: echo "Todos os steps passaram com sucesso!"
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
# sysadmin-toolkit
|
# sysadmin-toolkit
|
||||||
Repo de teste workflow
|
Repo de teste workflow
|
||||||
Texto AB
|
Texto A
|
||||||
Binary file not shown.
Executable
+25
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Script de deploy executado pelo GitHub Actions
|
||||||
|
|
||||||
|
echo "🚀 Iniciando deploy automático..."
|
||||||
|
echo "📦 Deploy ID: $(date +%Y%m%d-%H%M%S)"
|
||||||
|
|
||||||
|
# Verificar scripts
|
||||||
|
for script in scripts/*.sh; do
|
||||||
|
if [ -f "$script" ]; then
|
||||||
|
echo "✅ Validando $script..."
|
||||||
|
bash -n "$script" # Syntax check
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Simular deploy
|
||||||
|
echo "📂 Criando backup..."
|
||||||
|
mkdir -p backups
|
||||||
|
tar -czf "backups/backup-$(date +%Y%m%d).tar.gz" scripts/
|
||||||
|
|
||||||
|
echo "🔧 Executando verificações pós-deploy..."
|
||||||
|
./scripts/ping_monitor.sh
|
||||||
|
./scripts/ram-monitor.sh
|
||||||
|
./scripts/disk-monitor.sh
|
||||||
|
|
||||||
|
echo "✅ Deploy concluído com sucesso!"
|
||||||
Executable
+2
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
df -h
|
||||||
@@ -1,4 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
HOST="8.8.8.8"
|
HOST="8.8.8.8"
|
||||||
echo "Testando conectividade..."
|
echo "Testando conectividade..."
|
||||||
|
echo "🌐 Testando conectividade com $HOST..."
|
||||||
ping -c 4 $HOST
|
ping -c 4 $HOST
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "✅ Conexão OK"
|
||||||
|
else
|
||||||
|
echo "❌ Falha na conexão"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|||||||
Executable
+2
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
free -h
|
||||||
Reference in New Issue
Block a user