-
Notifications
You must be signed in to change notification settings - Fork 1
deploy: final fix #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| name: FarmSmart CI/CD Pipeline | ||
|
|
||
| # Trigger the workflow on pushes and pull requests to the main branch | ||
| on: | ||
| push: | ||
| branches: [ "main" ] | ||
| pull_request: | ||
| branches: [ "main" ] | ||
|
|
||
| # Define environment variables if needed | ||
| env: | ||
| NODE_VERSION: '18.x' | ||
|
|
||
| jobs: | ||
| # ------------------------------------------------------------------ | ||
| # JOB 1: BACKEND CI (Test & Build) | ||
| # ------------------------------------------------------------------ | ||
| backend-ci: | ||
| name: Backend CI (Test & Build) | ||
| runs-on: ubuntu-latest | ||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: ./backend | ||
|
|
||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Node.js ${{ env.NODE_VERSION }} | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: 'npm' | ||
| cache-dependency-path: backend/package-lock.json | ||
|
|
||
| - name: Install Dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Run Tests (Jest) | ||
| run: npm test -- --passWithNoTests | ||
|
|
||
| - name: Build / Type Check (TypeScript) | ||
| run: npm run build | ||
|
|
||
| # ------------------------------------------------------------------ | ||
| # JOB 2: FRONTEND CI (Lint & Build) | ||
| # ------------------------------------------------------------------ | ||
| frontend-ci: | ||
| name: Frontend CI (Lint & Build) | ||
| runs-on: ubuntu-latest | ||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: ./frontend | ||
|
|
||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Node.js ${{ env.NODE_VERSION }} | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: 'npm' | ||
| cache-dependency-path: frontend/package-lock.json | ||
|
|
||
| - name: Install Dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Lint Code (ESLint) | ||
| # Only run lint if the script exists | ||
| run: npm run lint --if-present | ||
|
|
||
| - name: Build Project (Vite) | ||
| run: npm run build | ||
|
|
||
| # ------------------------------------------------------------------ | ||
| # JOB 3: DEPLOY TO RENDER (CD) | ||
| # ------------------------------------------------------------------ | ||
| deploy: | ||
| name: Deploy to Render | ||
| needs: [backend-ci, frontend-ci] # Only deploy if CI passes | ||
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Trigger Render Deploy (Backend) | ||
| if: env.RENDER_DEPLOY_HOOK_BACKEND != '' | ||
| run: curl "${{ secrets.RENDER_DEPLOY_HOOK_BACKEND }}" | ||
|
|
||
| - name: Trigger Render Deploy (Frontend) | ||
| if: env.RENDER_DEPLOY_HOOK_FRONTEND != '' | ||
| run: curl "${{ secrets.RENDER_DEPLOY_HOOK_FRONTEND }}" | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,7 @@ | |
| "@google/generative-ai": "^0.24.1", | ||
| "@prisma/client": "^6.19.2", | ||
| "@types/socket.io": "^3.0.1", | ||
| "@types/twilio": "^3.19.2", | ||
| "bcrypt": "^6.0.0", | ||
| "cloudinary": "^2.9.0", | ||
|
Comment on lines
39
to
44
|
||
| "cors": "^2.8.6", | ||
|
|
@@ -49,6 +50,7 @@ | |
| "mongoose": "^8.22.0", | ||
| "multer": "^2.1.1", | ||
| "redis": "^4.7.0", | ||
| "socket.io": "^4.8.3" | ||
| "socket.io": "^4.8.3", | ||
| "twilio": "^5.12.2" | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These deploy steps are guarded by
env.RENDER_DEPLOY_HOOK_BACKEND/env.RENDER_DEPLOY_HOOK_FRONTEND, but those env vars are never set in this workflow. As a result the steps will always be skipped and deploy won't trigger. Checksecrets.RENDER_DEPLOY_HOOK_*in theif:condition (or set the env vars from secrets).