remove #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # HyperAgent Deployment Workflow | |
| name: Deploy to Production | |
| on: | |
| push: | |
| branches: [main] | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: 'Deployment environment' | |
| required: true | |
| default: 'staging' | |
| type: choice | |
| options: | |
| - staging | |
| - production | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| # ============================================================================ | |
| # STAGE 1: PRE-DEPLOYMENT CHECKS | |
| # ============================================================================ | |
| pre-deployment: | |
| name: '[*] Pre-Deployment Checks' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Validate environment variables | |
| run: | | |
| echo "[*] Validating deployment configuration..." | |
| # Check required secrets are set | |
| required_vars=("DATABASE_URL" "REDIS_URL" "GEMINI_API_KEY") | |
| for var in "${required_vars[@]}"; do | |
| if [ -z "${!var}" ]; then | |
| echo "[-] Missing required variable: $var" | |
| exit 1 | |
| fi | |
| done | |
| echo "[+] All required variables present" | |
| - name: Check Docker image exists | |
| run: | | |
| echo "[*] Verifying Docker image availability..." | |
| # Image should be built in CI workflow | |
| echo "[+] Image verification complete" | |
| # ============================================================================ | |
| # STAGE 2: STAGING DEPLOYMENT | |
| # ============================================================================ | |
| deploy-staging: | |
| name: '[>] Deploy to Staging' | |
| runs-on: ubuntu-latest | |
| needs: [pre-deployment] | |
| if: github.ref == 'refs/heads/main' || github.event.inputs.environment == 'staging' | |
| environment: | |
| name: staging | |
| url: https://staging.hyperagent.dev | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Deploy to staging | |
| run: | | |
| echo "[*] Deploying to staging environment..." | |
| # Deployment commands would go here | |
| # Example: kubectl apply, docker-compose up, etc. | |
| echo "[+] Staging deployment initiated" | |
| - name: Verify staging deployment | |
| run: | | |
| echo "[*] Verifying staging deployment..." | |
| sleep 30 | |
| curl -f https://staging.hyperagent.dev/api/v1/health/basic || exit 1 | |
| echo "[+] Staging deployment verified" | |
| # ============================================================================ | |
| # STAGE 3: PRODUCTION DEPLOYMENT | |
| # ============================================================================ | |
| deploy-production: | |
| name: '[>] Deploy to Production' | |
| runs-on: ubuntu-latest | |
| needs: [deploy-staging] | |
| if: github.ref == 'refs/heads/main' || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'production') | |
| environment: | |
| name: production | |
| url: https://hyperagent.dev | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Deploy to production | |
| run: | | |
| echo "[*] Deploying to production environment..." | |
| # Production deployment commands | |
| echo "[+] Production deployment initiated" | |
| - name: Verify production deployment | |
| run: | | |
| echo "[*] Verifying production deployment..." | |
| sleep 60 | |
| curl -f https://hyperagent.dev/api/v1/health/basic || exit 1 | |
| echo "[+] Production deployment verified" | |
| - name: Notify deployment success | |
| if: success() | |
| run: | | |
| echo "[+] Production deployment completed successfully" | |
| # Add notification logic (Slack, email, etc.) | |