107 lines
3.6 KiB
Markdown
107 lines
3.6 KiB
Markdown
# Setup 01 — GitHub
|
|
|
|
## 1. Crear el repositorio
|
|
|
|
1. Ve a [github.com/new](https://github.com/new)
|
|
2. Nombre: `carlospalanca.es`
|
|
3. Visibilidad: **Public** (recomendado para web personal) o Private
|
|
4. **No** inicialices con README (ya tienes el código)
|
|
5. Clic en "Create repository"
|
|
|
|
## 2. Push inicial
|
|
|
|
Desde tu máquina local en la carpeta del proyecto:
|
|
|
|
```bash
|
|
git init
|
|
git add .
|
|
git commit -m "feat: initial project setup with agents"
|
|
git branch -M main
|
|
git remote add origin https://github.com/TU_USUARIO/carlospalanca.es.git
|
|
git push -u origin main
|
|
```
|
|
|
|
## 3. Crear el GitHub Fine-Grained PAT
|
|
|
|
Este token lo usarán los agentes para crear ramas y PRs.
|
|
|
|
1. Ve a [github.com/settings/tokens](https://github.com/settings/tokens)
|
|
2. Clic en **"Fine-grained tokens"** → **"Generate new token"**
|
|
3. Configura:
|
|
- **Token name:** `carlospalanca-agents`
|
|
- **Expiration:** 1 año (o "No expiration")
|
|
- **Resource owner:** Tu usuario
|
|
- **Repository access:** Only selected repositories → selecciona `carlospalanca.es`
|
|
4. En **Repository permissions**, activa:
|
|
- **Contents:** Read and write
|
|
- **Pull requests:** Read and write
|
|
5. Clic en **"Generate token"**
|
|
6. **Copia el token** (empieza por `github_pat_...`) — solo lo verás una vez
|
|
|
|
> Guarda este token como `GITHUB_TOKEN` en el `.env` de los agentes.
|
|
|
|
## 4. Añadir GitHub Secrets
|
|
|
|
Estos secretos los usa el workflow de deploy.
|
|
|
|
1. Ve a tu repo → **Settings** → **Secrets and variables** → **Actions**
|
|
2. Clic en **"New repository secret"** y añade:
|
|
|
|
| Nombre | Valor |
|
|
|--------|-------|
|
|
| `VPS_SSH_PRIVATE_KEY` | Contenido completo de la clave privada SSH del usuario `deploy` |
|
|
| `VPS_HOST` | IP pública del VPS (ej: `123.456.789.0`) |
|
|
| `VPS_USER` | `deploy` |
|
|
|
|
> Para obtener la clave privada: ejecuta `cat ~/.ssh/id_ed25519` en el VPS (o la ruta donde generaste la keypair del usuario deploy).
|
|
|
|
## 5. Crear Labels
|
|
|
|
1. Ve a tu repo → **Issues** → **Labels**
|
|
2. Crea estos labels (o ve a la URL: `https://github.com/TU_USUARIO/carlospalanca.es/labels`):
|
|
|
|
| Label | Color | Descripción |
|
|
|-------|-------|-------------|
|
|
| `agent-created` | `#0075ca` | Contenido creado por un agente de IA |
|
|
| `needs-review` | `#e4e669` | Requiere revisión humana antes de mergear |
|
|
| `approved` | `#0e8a16` | Aprobado por Carlos, listo para mergear |
|
|
|
|
## 6. Activar Branch Protection en `main`
|
|
|
|
1. Ve a **Settings** → **Branches** → **Add branch ruleset** (o "Add rule")
|
|
2. Branch name pattern: `main`
|
|
3. Activa:
|
|
- ✅ **Require a pull request before merging**
|
|
- ✅ Require approvals: 0 (eres tú solo, no necesitas aprobador extra)
|
|
- ✅ **Require status checks to pass before merging**
|
|
- Busca y añade: `Build & Validate` (el job del ci.yml)
|
|
- ✅ **Do not allow bypassing the above settings**
|
|
4. Clic en **"Create"**
|
|
|
|
> Esto garantiza que ni tú ni los agentes puedan hacer push directo a `main`.
|
|
|
|
## 7. Verificar que el CI funciona
|
|
|
|
1. Crea un branch de prueba:
|
|
```bash
|
|
git checkout -b test/ci-check
|
|
echo "test" >> README.md
|
|
git add README.md
|
|
git commit -m "test: verify CI pipeline"
|
|
git push origin test/ci-check
|
|
```
|
|
2. Abre un PR en GitHub
|
|
3. Verifica que el workflow `CI - Build Check` se ejecuta y pasa
|
|
4. Verifica que comenta "✅ Build exitoso" en el PR
|
|
5. Puedes cerrar el PR sin mergear
|
|
|
|
## Checklist
|
|
|
|
- [ ] Repositorio creado en GitHub
|
|
- [ ] Push inicial completado
|
|
- [ ] Fine-Grained PAT creado y copiado
|
|
- [ ] 3 GitHub Secrets añadidos (VPS_SSH_PRIVATE_KEY, VPS_HOST, VPS_USER)
|
|
- [ ] Labels creados (agent-created, needs-review, approved)
|
|
- [ ] Branch protection activada en `main`
|
|
- [ ] CI workflow verificado en PR de prueba
|