Skip to content

Commit 4486fd4

Browse files
committed
Fix deployment issues: Update render.yaml for both frontend and backend, fix contracts.py for pdfkit dependency, update config.js for API_URL export, improve GitHub Actions workflow
1 parent 0c8331c commit 4486fd4

4 files changed

Lines changed: 125 additions & 468 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 33 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ jobs:
2424
uses: actions/setup-node@v3
2525
with:
2626
node-version: '18'
27-
# Disable cache to prevent package-lock.json issues
28-
# cache: 'npm'
29-
# cache-dependency-path: 'frontend/package-lock.json'
3027

3128
- name: Setup Python
3229
uses: actions/setup-python@v4
@@ -38,19 +35,22 @@ jobs:
3835
- name: Install frontend dependencies
3936
run: |
4037
cd frontend
41-
echo "Current directory: $(pwd)"
42-
echo "Removing package-lock.json"
43-
rm -f package-lock.json
44-
echo "Installing dependencies with npm run ci-install script"
45-
npm run ci-install
46-
echo "Dependency installation completed"
38+
npm ci || npm install
39+
40+
- name: Debug environment variables
41+
run: |
42+
echo "Checking environment variables"
43+
echo "NODE_ENV: $NODE_ENV"
44+
echo "REACT_APP_API_URL: $REACT_APP_API_URL"
4745
4846
- name: Build frontend
4947
env:
50-
REACT_APP_API_URL: ${{ secrets.REACT_APP_API_URL }}
48+
NODE_ENV: production
49+
REACT_APP_API_URL: ${{ secrets.REACT_APP_API_URL || 'https://smartprobono-api.onrender.com' }}
50+
REACT_APP_WS_URL: ${{ secrets.REACT_APP_WS_URL || 'wss://smartprobono-api.onrender.com' }}
5151
run: |
5252
cd frontend
53-
npm run build
53+
DISABLE_ESLINT_PLUGIN=true npm run build
5454
5555
- name: Install backend dependencies
5656
run: |
@@ -60,39 +60,33 @@ jobs:
6060
- name: Setup Cloudinary
6161
run: |
6262
cd backend
63-
echo "Checking Python version"
64-
python --version
65-
echo "Checking script exists"
66-
ls -la scripts/
67-
echo "Running Cloudinary setup"
6863
python scripts/setup_cloudinary.py --test-only
69-
70-
- name: Run database migrations
71-
run: |
72-
cd backend
73-
python -m flask db upgrade
74-
75-
- name: Deploy to Netlify (Frontend)
7664
env:
77-
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
78-
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
79-
run: |
80-
npm install -g netlify-cli
81-
cd frontend
82-
netlify deploy --prod --dir=build
65+
CLOUDINARY_CLOUD_NAME: ${{ secrets.CLOUDINARY_CLOUD_NAME }}
66+
CLOUDINARY_API_KEY: ${{ secrets.CLOUDINARY_API_KEY }}
67+
CLOUDINARY_API_SECRET: ${{ secrets.CLOUDINARY_API_SECRET }}
8368

84-
- name: Deploy to Render (Backend)
85-
if: success()
69+
- name: Deploy to Render
8670
env:
87-
RENDER_SERVICE_ID: ${{ secrets.RENDER_SERVICE_ID }}
88-
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }}
71+
RENDER_TOKEN: ${{ secrets.RENDER_API_KEY }}
8972
run: |
90-
curl -X POST "https://api.render.com/v1/services/$RENDER_SERVICE_ID/deploys" \
91-
-H "Authorization: Bearer $RENDER_API_KEY" \
73+
# Deploy backend
74+
curl -X POST \
75+
-H "Authorization: Bearer $RENDER_TOKEN" \
76+
-H "Content-Type: application/json" \
77+
"https://api.render.com/v1/services/${{ secrets.RENDER_BACKEND_ID }}/deploys"
78+
79+
# Deploy frontend
80+
curl -X POST \
81+
-H "Authorization: Bearer $RENDER_TOKEN" \
9282
-H "Content-Type: application/json" \
93-
-d '{"clearCache": "clear"}'
83+
"https://api.render.com/v1/services/${{ secrets.RENDER_FRONTEND_ID }}/deploys"
9484
95-
- name: Notify failed deployment
96-
if: failure()
85+
- name: Notify deployment status
86+
if: always()
9787
run: |
98-
echo "Deployment failed! Check the logs for more information."
88+
if [ "${{ job.status }}" = "success" ]; then
89+
echo "Deployment completed successfully!"
90+
else
91+
echo "Deployment failed! Check the logs for more information."
92+
fi

0 commit comments

Comments
 (0)