-
Notifications
You must be signed in to change notification settings - Fork 0
Setup
Carlos Lopez edited this page Jul 16, 2026
·
1 revision
Instrucciones para configurar GitHub Actions y CI/CD.
Se han creado tres workflows automáticos en .github/workflows/:
Cuándo se ejecuta:
- En cada
pushamainodevelop - En cada
pull_requestamainodevelop
Qué hace:
- Instala Node.js (versiones 20 y 22)
- Instala dependencias
- Ejecuta type check:
npm run typecheck - Ejecuta tests:
npm run test - Sube coverage a Codecov
Requisitos: Ninguno extra, funcionará automáticamente
Cuándo se ejecuta:
- En
pushamain - Con tags
gitdb-vX.Y.Z - Manual vía
workflow_dispatch
Qué hace:
- Verifica type check y tests
- Build del proyecto
- Publica en NPM
Requisitos:
- Configurar
NPM_TOKENen GitHub Secrets
Cuándo se ejecuta:
- En cada
pushamainodevelop - Detecta archivos en
.changeset/
Qué hace:
- Si hay changesets: Crea PR de versión automático
- Al hacer merge del PR: Publica automáticamente en NPM
Requisitos:
- Configurar
NPM_TOKENen GitHub Secrets
- Ve a https://npmjs.com
- Click en tu avatar → "Account"
- Izquierda: "Auth Tokens"
- Click "Generate New Token" → "Automation"
- Copia el token
- Ve a tu repo en GitHub
- Settings → Secrets and variables → Actions
- Click "New repository secret"
- Nombre:
NPM_TOKEN - Valor: Pega el token de NPM
- Click "Add secret"
Los workflows usarán automáticamente el token:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}# 1. Crear rama
git checkout -b fix/bug-name
# 2. Hacer cambios
# ... edita archivos ...
npm run test # Verifica que tests pasen
# 3. Crear changeset
npm run changeset
# Selecciona: patch para bug fixes
# Describe el cambio
# 4. Push
git add .changeset/
git commit -m "fix: descripción del bug"
git push origin fix/bug-name
# 5. GitHub Actions automáticamente:
# ✅ Ejecuta tests
# ✅ Verifica types
# ✅ Crea PR de versión
# ✅ Al mergear → Publica en NPMgit checkout -b feat/feature-name
# ... edita archivos ...
npm run test
npm run changeset
# Selecciona: minor para nuevas features
# Describe el cambio
git add .changeset/
git commit -m "feat: descripción"
git push origin feat/feature-name
# GitHub Actions:
# ✅ Ejecuta tests
# ✅ Crea PR de versión (incrementa 0.x.0)
# ✅ Publica en NPMgit checkout -b feat/breaking-change
# ... edita archivos ...
npm run test
npm run changeset
# Selecciona: major para breaking changes
# Describe el cambio
git add .changeset/
git commit -m "feat!: descripción del breaking change"
git push origin feat/breaking-change
# GitHub Actions:
# ✅ Crea PR de versión (incrementa x.0.0)
# ✅ Publica en NPM- Ve al tab "Actions"
- Busca el workflow "Release with Changesets"
- Verifica que el workflow pasó
# Ver últimas versiones publicadas
npm view @kettu/gitdb versionsProblema: Error de autenticación
Solución:
- Verifica que
NPM_TOKENexiste en GitHub Secrets - Verifica que el token no expiró en npmjs.com
- Regenera el token si es necesario
Problema: Los changesets no se detectan
Solución:
- Verifica que los archivos están en
.changeset/ - Verifica que el push fue a
mainodevelop - Mira los logs en GitHub Actions
Problema: Git no está disponible en CI
Solución: Agregamos Git al workflow en test.yml
.github/
└── workflows/
├── test.yml # Tests en push/PR
├── publish-npm.yml # Publicar manualmente
└── changesets-release.yml # Release automático
Automáticamente disponibles:
-
GITHUB_TOKEN- Acceso al repo -
NODE_AUTH_TOKEN- Token de NPM (si configurado)
Para tests locales con Git:
git config --global user.name "Local Dev"
git config --global user.email "dev@example.com"
npm run test- Publishing - Cómo publicar releases
- Getting Started - Primeros pasos
- FAQ - Preguntas frecuentes