Fix Render deployment: Comment out gevent/eventlet dependencies in ba… #72
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
| name: Deploy SmartProBono | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| name: Deploy Frontend and Backend | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Debug - List all files in frontend directory | |
| run: | | |
| ls -la frontend/ | |
| cat frontend/package.json | grep -A 5 dependencies | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| cache-dependency-path: 'backend/requirements.txt' | |
| - name: Install frontend dependencies | |
| run: | | |
| cd frontend | |
| npm ci || npm install | |
| - name: Debug environment variables | |
| run: | | |
| echo "Checking environment variables" | |
| echo "NODE_ENV: $NODE_ENV" | |
| echo "REACT_APP_API_URL: $REACT_APP_API_URL" | |
| - name: Build frontend | |
| env: | |
| NODE_ENV: production | |
| REACT_APP_API_URL: ${{ secrets.REACT_APP_API_URL || 'https://smartprobono-api.onrender.com' }} | |
| REACT_APP_WS_URL: ${{ secrets.REACT_APP_WS_URL || 'wss://smartprobono-api.onrender.com' }} | |
| run: | | |
| cd frontend | |
| DISABLE_ESLINT_PLUGIN=true npm run build | |
| - name: Install backend dependencies | |
| run: | | |
| cd backend | |
| pip install -r requirements.txt | |
| - name: Setup Cloudinary | |
| run: | | |
| cd backend | |
| python scripts/setup_cloudinary.py --test-only | |
| env: | |
| CLOUDINARY_CLOUD_NAME: ${{ secrets.CLOUDINARY_CLOUD_NAME }} | |
| CLOUDINARY_API_KEY: ${{ secrets.CLOUDINARY_API_KEY }} | |
| CLOUDINARY_API_SECRET: ${{ secrets.CLOUDINARY_API_SECRET }} | |
| - name: Deploy to Render | |
| env: | |
| RENDER_TOKEN: ${{ secrets.RENDER_API_KEY }} | |
| run: | | |
| # Create environment variables payload for backend | |
| cat > env_vars.json << EOF | |
| { | |
| "envVars": [ | |
| {"key": "CLOUDINARY_CLOUD_NAME", "value": "${{ secrets.CLOUDINARY_CLOUD_NAME }}"}, | |
| {"key": "CLOUDINARY_API_KEY", "value": "${{ secrets.CLOUDINARY_API_KEY }}"}, | |
| {"key": "CLOUDINARY_API_SECRET", "value": "${{ secrets.CLOUDINARY_API_SECRET }}"}, | |
| {"key": "OPENAI_API_KEY", "value": "${{ secrets.OPENAI_API_KEY }}"}, | |
| {"key": "HUGGINGFACE_API_KEY", "value": "${{ secrets.HUGGINGFACE_API_KEY }}"} | |
| ] | |
| } | |
| EOF | |
| # Update environment variables for backend service | |
| curl -X PATCH \ | |
| -H "Authorization: Bearer $RENDER_TOKEN" \ | |
| -H "Content-Type: application/json" \ | |
| -d @env_vars.json \ | |
| "https://api.render.com/v1/services/${{ secrets.RENDER_BACKEND_ID }}/env-vars" | |
| # Deploy backend | |
| curl -X POST \ | |
| -H "Authorization: Bearer $RENDER_TOKEN" \ | |
| -H "Content-Type: application/json" \ | |
| "https://api.render.com/v1/services/${{ secrets.RENDER_BACKEND_ID }}/deploys" | |
| # Deploy frontend | |
| curl -X POST \ | |
| -H "Authorization: Bearer $RENDER_TOKEN" \ | |
| -H "Content-Type: application/json" \ | |
| "https://api.render.com/v1/services/${{ secrets.RENDER_FRONTEND_ID }}/deploys" | |
| - name: Notify deployment status | |
| if: always() | |
| run: | | |
| if [ "${{ job.status }}" = "success" ]; then | |
| echo "Deployment completed successfully!" | |
| else | |
| echo "Deployment failed! Check the logs for more information." | |
| fi |