Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ab24ed926b | |||
| d37dbc30f2 | |||
| d4287fbde3 | |||
| 31a1757c45 | |||
| 6861471ad3 | |||
| 4b2ce601ac | |||
| 02ca7dcd2a | |||
| 4563571bf2 | |||
| dcc43c7d93 | |||
| e3982eb7e3 | |||
| 66b2e6f54a | |||
| ffae6d51a2 | |||
| 80c2d04159 | |||
| bfd7ef2838 | |||
| 25d18686e4 | |||
| 9362771f7c | |||
| ba7d7066c0 | |||
| eca0284dac | |||
| 153f48a394 | |||
| fe367f4b04 | |||
| dc36dd2eef | |||
| 1f366d5d70 | |||
| 9c7bad351d | |||
| 8eedb63290 | |||
| af7a24fcf2 |
@@ -0,0 +1,40 @@
|
||||
name: Deploy CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: deploy
|
||||
container:
|
||||
image: alpine:latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
run: |
|
||||
apk add --no-cache git bash
|
||||
git clone http://10.11.10.71:3000/${{ gitea.repository }}.git .
|
||||
git checkout ${{ gitea.sha }}
|
||||
|
||||
- name: Validar scripts shell
|
||||
run: |
|
||||
echo "🔍 Validando sintaxe dos scripts..."
|
||||
for script in scripts/*.sh; do
|
||||
if [ -f "$script" ]; then
|
||||
echo "✅ Validando $script..."
|
||||
bash -n "$script"
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Executar verificações pós-deploy
|
||||
run: |
|
||||
echo "🔧 Executando verificações pós-deploy..."
|
||||
chmod +x scripts/*.sh
|
||||
./scripts/ping_monitor.sh
|
||||
./scripts/ram-monitor.sh
|
||||
./scripts/disk-monitor.sh
|
||||
|
||||
- name: Concluir deploy
|
||||
run: echo "✅ Deploy concluído com sucesso!"
|
||||
@@ -0,0 +1,71 @@
|
||||
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 curl
|
||||
fi
|
||||
python3 --version
|
||||
- name: 📦 Instalar curl se necessário
|
||||
run: |
|
||||
# Alpine usa apk, Ubuntu/Debian usa apt
|
||||
if command -v apk &>/dev/null; then
|
||||
apk add --no-cache curl
|
||||
elif command -v apt-get &>/dev/null; then
|
||||
apt-get update -qq && apt-get install -y -qq curl
|
||||
fi
|
||||
- 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
|
||||
Repo de teste workflow
|
||||
Texto AB
|
||||
Texto A
|
||||
Binary file not shown.
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/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
|
||||
|
||||
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
|
||||
HOST="8.8.8.8"
|
||||
echo "Testando conectividade..."
|
||||
echo "🌐 Testando conectividade com $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