name: 🚀 Deploy GOD AGENT OS v11 on: push: branches: [ master, main, genspark_ai_developer ] workflow_dispatch: env: HF_SPACE: PYAE1994/autonomous-coding-system HF_USER: PYAE1994 jobs: # ── 1. Deploy Backend to HuggingFace Space ────────────────────────────────── deploy-hf-backend: name: 🤗 Deploy Backend to HF Space runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: 🐍 Setup Python uses: actions/setup-python@v5 with: python-version: '3.11' - name: 📦 Install HF Hub run: pip install huggingface_hub - name: 🔐 Push HF Space Secrets env: HF_TOKEN: ${{ secrets.HF_TOKEN }} GEMINI_KEY: ${{ secrets.GEMINI_KEY }} SAMBANOVA_KEY: ${{ secrets.SAMBANOVA_KEY }} GITHUB_KEY: ${{ secrets.GITHUB_KEY }} run: | python3 - <<'EOF' import os try: from huggingface_hub import HfApi token = os.environ.get("HF_TOKEN", "") if not token: print("No HF_TOKEN — skipping secret push") exit(0) api = HfApi(token=token) repo_id = "PYAE1994/autonomous-coding-system" secrets = { "GEMINI_KEY": os.environ.get("GEMINI_KEY", ""), "SAMBANOVA_KEY": os.environ.get("SAMBANOVA_KEY", ""), "GITHUB_KEY": os.environ.get("GITHUB_KEY", ""), "DB_PATH": "/data/god_agent_v11.db", "WORKSPACE_DIR": "/tmp/god_workspace", } for k, v in secrets.items(): if v: try: api.add_space_secret(repo_id=repo_id, key=k, value=v) print(f"✓ Set secret: {k}") except Exception as e: print(f"⚠ Secret {k}: {e}") except Exception as e: print(f"HF secrets error: {e}") EOF - name: 🚀 Push Backend to HF Space env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | git config --global user.email "ci@godagentos.ai" git config --global user.name "God Agent OS CI" # Clone HF space git clone https://${{ env.HF_USER }}:${HF_TOKEN}@huggingface.co/spaces/${{ env.HF_SPACE }} /tmp/hf-space || true # Copy backend files rsync -av --exclude='.git' --exclude='__pycache__' --exclude='*.pyc' \ backend/ /tmp/hf-space/ 2>/dev/null || cp -rf backend/. /tmp/hf-space/ || true cd /tmp/hf-space git add -A git diff --staged --quiet || git commit -m "🚀 Deploy God Agent OS v11 - $(date '+%Y-%m-%d %H:%M')" git push https://${{ env.HF_USER }}:${HF_TOKEN}@huggingface.co/spaces/${{ env.HF_SPACE }} HEAD:main || true echo "✅ HF Space deployment triggered" # ── 2. Deploy Frontend to Vercel ──────────────────────────────────────────── deploy-vercel-frontend: name: ▲ Deploy Frontend to Vercel runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: 🔧 Setup Node.js 20 uses: actions/setup-node@v4 with: node-version: '20' - name: 📦 Install Dependencies run: | cd frontend npm ci --legacy-peer-deps - name: 🏗️ Build Frontend env: NEXT_PUBLIC_API_URL: https://pyae1994-autonomous-coding-system.hf.space NEXT_PUBLIC_WS_URL: wss://pyae1994-autonomous-coding-system.hf.space run: | cd frontend npm run build - 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 }} working-directory: ./frontend vercel-args: '--prod' github-comment: false