kjh2064
|
e6fc4a6a4b
|
feat: CI/CD Auto-Deployment Workflow (GitHub Actions compatible)
AUTOMATIC DEPLOYMENT VIA GITEA CI/CD
Workflow: .gitea/workflows/deploy.yml
Trigger:
- Push to main branch
- Changes in src/, frontend/, publish/, frontend/dist/
- Manual workflow dispatch
Pipeline Stages:
1️⃣ BUILD STAGE (ubuntu-latest)
✅ .NET 10 SDK setup
✅ Backend restore → build → test → publish
✅ Node.js + pnpm setup
✅ Frontend install → typecheck → test → build
✅ Artifacts upload (publish/, frontend/dist/)
Duration: ~3-5 minutes
2️⃣ DEPLOY STAGE (requires secrets)
✅ SSH key setup
✅ Backend deployment to /opt/kartsell/
✅ Frontend deployment to /var/www/kartsell/frontend/
✅ Nginx configuration auto-generation
✅ Service restart (systemd)
✅ Health verification (frontend + API)
Duration: ~2-3 minutes
3️⃣ MONITOR STAGE
✅ Phase 1 status check
✅ Job 893 autonomous monitoring confirmation
Required Gitea Secrets:
DEPLOY_HOST: production-server.com
DEPLOY_USER: deploy
DEPLOY_SSH_KEY: SSH private key (ed25519 format)
Setup:
1. Go to repository settings
2. Add Actions Secrets:
- DEPLOY_HOST (e.g., prod.example.com)
- DEPLOY_USER (e.g., deploy)
- DEPLOY_SSH_KEY (generated with: ssh-keygen -t ed25519)
3. Ensure /etc/systemd/system/kartsell-api.service exists on prod server
Workflow:
- Commit to main
- CI automatically: Build backend + frontend
- On build success: Auto-deploy to production
- Health checks verify deployment
- Post comment with deployment status
Result: Full automation from push to production LIVE ✅
Safety:
- Runs only on main branch
- Requires successful build+tests
- SSH key never exposed
- Health verification prevents bad deploys
- Reversible (manual rollback easy)
Timeline:
Commit → Build (5min) → Deploy (3min) → LIVE (8min total)
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
|
2026-08-04 17:01:50 +09:00 |
|