This repository has been archived on 2026-11-17. You can view files and clone it, but cannot push or open issues or pull requests.
gitgram-ai/gitgram/.github/workflows/production-deploy.yml
caelum0x 49b183818c Unify gitgram + aitimemachine into the monorepo (de-submodule) and merge vendored engines
Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as
opaque submodule gitlinks on GitHub) into fully-tracked first-party content.

AITM now merges its 7 vendored repos as first-party engines:
- memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts
- git: vendored C git (bundled binary) + gitnexus (in-process code intelligence)
- agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess)

Includes the full session's product build: Gitgram web/mobile/backend features,
AITM website/CLI/MCP, the unified memory layer, engine build tooling
(scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md),
and extensive test suites.

Build artifacts, node_modules, external/, and gemini-cli are gitignored.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 14:14:09 +03:00

254 lines
6.7 KiB
YAML

name: Production Deployment
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
env:
NODE_VERSION: '18.x'
jobs:
# Backend Tests
backend-test:
name: Backend Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: gitgram_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: backend/package-lock.json
- name: Install dependencies
working-directory: backend
run: npm ci
- name: Run Prisma migrations
working-directory: backend
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/gitgram_test
run: npx prisma migrate deploy
- name: Security audit
working-directory: backend
run: npm audit --audit-level=high || true
- name: Run tests
working-directory: backend
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/gitgram_test
REDIS_URL: redis://localhost:6379
JWT_SECRET: test-secret
JWT_REFRESH_SECRET: test-refresh-secret
run: npm test
- name: Build
working-directory: backend
run: npm run build
# Frontend Tests
frontend-test:
name: Frontend Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: web/package-lock.json
- name: Install dependencies
working-directory: web
run: npm ci
- name: Run linter
working-directory: web
run: npm run lint
- name: Run tests
working-directory: web
run: npm test -- --watchAll=false --passWithNoTests
- name: Build
working-directory: web
env:
NEXT_PUBLIC_API_URL: https://api.gitgram.app/api
NEXT_PUBLIC_SOCKET_URL: https://api.gitgram.app
run: npm run build
# Security Scan
security-scan:
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
scan-ref: '.'
format: 'sarif'
output: 'trivy-results.sarif'
- name: Upload Trivy results to GitHub Security
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'
# Deploy Backend
deploy-backend:
name: Deploy Backend
needs: [backend-test, security-scan]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install Railway CLI
run: npm install -g @railway/cli
- name: Deploy to Railway
working-directory: backend
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
run: railway up --service backend
- name: Run database migrations
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
run: |
cd backend
npx prisma migrate deploy
- name: Notify Sentry of deployment
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: gitgram-backend
with:
environment: production
# Deploy Frontend
deploy-frontend:
name: Deploy Frontend
needs: [frontend-test, security-scan]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Deploy to Vercel
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
vercel-args: '--prod'
working-directory: web
- name: Notify Sentry of deployment
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: gitgram-frontend
with:
environment: production
# Health Check
health-check:
name: Post-Deployment Health Check
needs: [deploy-backend, deploy-frontend]
runs-on: ubuntu-latest
steps:
- name: Wait for deployment
run: sleep 30
- name: Check backend health
run: |
response=$(curl -s -o /dev/null -w "%{http_code}" https://api.gitgram.app/health)
if [ $response -ne 200 ]; then
echo "Backend health check failed with status $response"
exit 1
fi
echo "Backend health check passed"
- name: Check frontend
run: |
response=$(curl -s -o /dev/null -w "%{http_code}" https://gitgram.app)
if [ $response -ne 200 ]; then
echo "Frontend health check failed with status $response"
exit 1
fi
echo "Frontend health check passed"
- name: Notify on failure
if: failure()
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
text: 'Deployment health check failed!'
webhook_url: ${{ secrets.SLACK_WEBHOOK }}
- name: Notify on success
if: success()
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
text: 'Deployment successful! 🚀'
webhook_url: ${{ secrets.SLACK_WEBHOOK }}