Revisão Logo, Favicon, Robots
This commit is contained in:
@@ -0,0 +1,135 @@
|
||||
# CI/CD - Avanzato Tecnologia
|
||||
|
||||
## Estrutura do Pipeline
|
||||
|
||||
```
|
||||
Push para main/master
|
||||
|
|
||||
v
|
||||
+------------------+ +------------------+ +------------------+
|
||||
| BUILD | --> | PRESERVAR ASSETS | --> | DEPLOY |
|
||||
| | | | | |
|
||||
| - Checkout | | - Logo | | - SCP para VPS |
|
||||
| - npm install | | - Imagens | | - Limpar cache |
|
||||
| - npm run build | | - Favicon | | - Notificar |
|
||||
+------------------+ +------------------+ +------------------+
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Configurar Secrets no GitHub
|
||||
|
||||
Va em: **Settings > Secrets and variables > Actions > New repository secret**
|
||||
|
||||
| Secret | Descricao | Exemplo |
|
||||
|--------|-----------|---------|
|
||||
| `SSH_HOST` | IP ou dominio do servidor | `201.45.120.30` ou `avanzato.com.br` |
|
||||
| `SSH_USER` | Usuario SSH | `root` ou `deploy` |
|
||||
| `SSH_PRIVATE_KEY` | Chave SSH privada | `-----BEGIN OPENSSH PRIVATE KEY-----...` |
|
||||
| `SSH_PORT` | Porta SSH (opcional) | `22` |
|
||||
| `DEPLOY_PATH` | Caminho no servidor | `/var/www/avanzato` |
|
||||
| `STAGING_PATH` | Caminho staging (opcional) | `/var/www/avanzato-staging` |
|
||||
|
||||
### Como gerar a chave SSH:
|
||||
|
||||
```bash
|
||||
# No seu computador (NAO no servidor):
|
||||
ssh-keygen -t ed25519 -C "github-actions" -f ~/.ssh/github_actions
|
||||
|
||||
# Copiar publica para o servidor:
|
||||
ssh-copy-id -i ~/.ssh/github_actions.pub root@SEU_SERVIDOR
|
||||
|
||||
# Copiar privada para o GitHub Secret:
|
||||
cat ~/.ssh/github_actions
|
||||
# Cole o conteudo inteiro no secret SSH_PRIVATE_KEY
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Estrutura de Branches
|
||||
|
||||
```
|
||||
main/master --> Deploy automatico para producao
|
||||
staging --> Deploy automatico para staging (se existir)
|
||||
feature/* --> Apenas build (sem deploy)
|
||||
hotfix/* --> Apenas build (sem deploy)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Como Funciona
|
||||
|
||||
### Cenario 1: Deploy Automatico
|
||||
```
|
||||
1. Voce faz push para main
|
||||
2. GitHub Actions executa automaticamente
|
||||
3. Build + Deploy em ~2 minutos
|
||||
4. Site atualizado!
|
||||
```
|
||||
|
||||
### Cenario 2: Deploy Manual
|
||||
```
|
||||
1. Va em Actions > Build e Deploy
|
||||
2. Clique "Run workflow"
|
||||
3. Escolha: production ou staging
|
||||
4. Clique "Run"
|
||||
```
|
||||
|
||||
### Cenario 3: Pull Request
|
||||
```
|
||||
1. Cria PR para main
|
||||
2. CI executa build (testa se compila)
|
||||
3. NAO faz deploy
|
||||
4. Merge aprovado? Deploy automatico!
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Assets Customizados (Logo, Imagens)
|
||||
|
||||
Para preservar assets apos o deploy automatico:
|
||||
|
||||
### 1. Commitar assets no repositorio
|
||||
|
||||
```bash
|
||||
git add custom-assets/logo/logo.png
|
||||
git add custom-assets/images/
|
||||
git commit -m "Adiciona logo e imagens customizadas"
|
||||
git push origin main
|
||||
```
|
||||
|
||||
### 2. O pipeline faz sozinho
|
||||
|
||||
O workflow executa automaticamente:
|
||||
```bash
|
||||
bash scripts/preserve-assets.sh dist/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Monitore os Deploys
|
||||
|
||||
- **GitHub Actions**: https://github.com/SEU_USUARIO/avanzato-site/actions
|
||||
- **Status**: Check verde = sucesso, X vermelho = falha
|
||||
- **Logs**: Clique no workflow para ver detalhes
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Deploy falhou?
|
||||
|
||||
1. **Verifique os secrets**: Settings > Secrets > Actions
|
||||
2. **Verifique a chave SSH**: `ssh -i ~/.ssh/github_actions root@SEU_SERVIDOR`
|
||||
3. **Verifique permissoes**: O usuario precisa de acesso de escrita no DEPLOY_PATH
|
||||
4. **Verifique logs**: Actions > Clique no workflow > Veja o passo que falhou
|
||||
|
||||
### Assets nao preservados?
|
||||
|
||||
1. Verifique se `custom-assets/` esta no repositorio
|
||||
2. Verifique se os arquivos estao comitados: `git ls-files custom-assets/`
|
||||
3. Verifique os logs do passo "Preservar assets customizados"
|
||||
|
||||
---
|
||||
|
||||
*Configurado em: Maio 2026*
|
||||
Reference in New Issue
Block a user