Implements local CI/CD workflow: - pre-push git hook triggers release pipeline - Runs in releases/ directory after successful push - Validates, builds, and deploys changed services Components: - .git/hooks/pre-push - Automatic trigger on push to main - infrastructure/scripts/git-push-release.sh - Manual wrapper - infrastructure/scripts/RELEASE_WORKFLOW.md - Documentation Workflow: 1. Developer: git push (on main) 2. Hook: Triggers release-deploy.sh in background 3. Pipeline: Sync → Validate → Build → Deploy → Push releases 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
4.6 KiB
4.6 KiB
Release Workflow
Automatic Release on Push
When you push to the main branch, a release is automatically triggered via git hooks.
How It Works
┌─────────────────────────────────────────────────────────┐
│ Developer Workflow │
├─────────────────────────────────────────────────────────┤
│ │
│ 1. Work in codebase/ (features/status-dashboard/*) │
│ 2. Commit changes │
│ 3. git push ← Automatic trigger │
│ │
│ ↓ (pre-push hook activates) │
│ │
│ 4. Push completes to GitLab │
│ 5. Release pipeline starts in background │
│ │
└─────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────┐
│ Release Pipeline (runs in releases/) │
├─────────────────────────────────────────────────────────┤
│ │
│ 1. Sync codebase → releases/ │
│ 2. Run typecheck, lint, tests │
│ 3. Build changed services │
│ 4. Deploy to VPS (status-dashboard, etc.) │
│ 5. Push releases/ to GitLab │
│ │
└─────────────────────────────────────────────────────────┘
Git Hook Setup
Location: codebase/.git/hooks/pre-push
Trigger Condition: Pushing to main branch
Action:
- Runs
infrastructure/scripts/release-deploy.shin background - Logs output to
releases/release.log
Manual Release Trigger
If you want to trigger a release without pushing:
cd releases/
../codebase/infrastructure/scripts/release-deploy.sh
Or use the wrapper script:
cd codebase/
git push-release # Custom alias: push + optional release
Monitoring Release Progress
# Follow live log
tail -f releases/release.log
# Check last release
cat releases/release.log | tail -100
Release Script Location
Main script: infrastructure/scripts/release-deploy.sh
What it does:
- Syncs from codebase to releases
- Generates ML commit messages
- Creates version tags
- Detects changed services
- Deploys to VPS via:
- Docker (for containerized services)
- PM2 (for Node.js services)
- Python systemd (for Python services)
Configuration
Environment: infrastructure/env/.env.release
Key variables:
RELEASES_DIR- Path to releases repositoryVPS_HOST- Deployment target VPSML_CONTENT_GENERATOR_URL- For commit message generation
Deployment Targets
| Service | Type | Deploy Method | Health Check |
|---|---|---|---|
| status-dashboard (frontend) | Static | nginx + rsync | HTTPS response |
| status-dashboard (server) | Node.js | PM2 | API /health endpoint |
| status-dashboard (agent) | Node.js | systemd | Process status |
Troubleshooting
Release not triggering?
- Check hook is executable:
ls -la .git/hooks/pre-push - Verify you're on main branch:
git branch - Check releases/ directory exists
Release failed?
- Check log:
cat releases/release.log - Manually run:
cd releases && ../codebase/infrastructure/scripts/release-deploy.sh
Want to disable auto-release?
chmod -x .git/hooks/pre-push
Next Steps
- Update
infrastructure/scripts/release-deploy.shfor lilith-platform structure - Configure
.env.releasewith VPS credentials - Test deployment:
git push(on main branch)