-
Notifications
You must be signed in to change notification settings - Fork 117
feat : CI/CD pipeline created #151
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
base: main
Are you sure you want to change the base?
Conversation
|
@Prasad-D-Ware is attempting to deploy a commit to the AJEET PRATAP SINGH's projects Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughAdds a GitHub Actions CI/CD workflow at Changes
Sequence DiagramsequenceDiagram
autonumber
actor Trigger as Push/PR (main)
participant GHA as GitHub Actions
participant Build as build
participant Docker as docker-build-and-push
participant Vercel as deploy-vercel
Trigger->>GHA: trigger workflow
GHA->>Build: run build job
Build->>Build: checkout, setup PNPM/Node\ninstall deps, lint, build
Build-->>GHA: build complete
par After build (parallel)
GHA->>Docker: start docker-build-and-push
Docker->>Docker: login ghcr.io\nsetup QEMU & Buildx\nextract metadata\nbuild & push image (cache)
Docker-->>GHA: docker complete
and
GHA->>Vercel: start deploy-vercel
Vercel->>Vercel: setup PNPM/Node\ninstall Vercel CLI\npull env info\nbuild & deploy from apps/web
Vercel-->>GHA: deploy complete
end
GHA-->>Trigger: workflow finished
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.github/workflows/ci-cd.yml (2)
106-114: Consider using environment variables for sensitive tokens to improve log safety.Passing
VERCEL_TOKENas a command-line argument (lines 106, 110, 114) may inadvertently expose it in logs or error messages, even though GitHub Actions masks some secret values. The Vercel CLI supports readingVERCEL_TOKENfrom environment variables.Refactor the deploy-vercel job to use environment variables instead:
deploy-vercel: needs: build runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} steps: ... - name: Pull Vercel Environment Information - run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} + run: vercel pull --yes --environment=production working-directory: ./apps/web - name: Build Project Artifacts - run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + run: vercel build --prod working-directory: ./apps/web - name: Deploy Project Artifacts to Vercel - run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} + run: vercel deploy --prebuilt --prod working-directory: ./apps/web
82-115: Recommend adding explicit handling for missing Vercel secrets.The deploy-vercel job relies on three Vercel secrets (VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID) without validation. If any secret is missing, the job will fail silently during the
vercel pullstep, making debugging harder for the team.Consider adding an early validation step to fail fast with a clear error message:
- name: Validate Vercel secrets run: | if [ -z "$VERCEL_TOKEN" ]; then echo "ERROR: VERCEL_TOKEN secret is not set" exit 1 fi if [ -z "$VERCEL_ORG_ID" ]; then echo "ERROR: VERCEL_ORG_ID secret is not set" exit 1 fi if [ -z "$VERCEL_PROJECT_ID" ]; then echo "ERROR: VERCEL_PROJECT_ID secret is not set" exit 1 fiAdd this step immediately after the setup-node step and before the Vercel CLI install.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/ci-cd.yml(1 hunks)
🔇 Additional comments (4)
.github/workflows/ci-cd.yml (4)
3-37: Good workflow structure with proper build foundation.The build job is well-configured: uses
--frozen-lockfilefor reproducible dependencies, runs linting before build, and establishes a dependency that other jobs can wait on. The use of pnpm caching is efficient for CI/CD.
42-61: Good Docker registry security practices.The docker-build-and-push job correctly restricts permissions (read
contents, writepackages) and uses GitHub-providedGITHUB_TOKENfor authentication to ghcr.io rather than storing credentials separately.
63-80: Docker image tagging and caching strategy is sound.Using SHA-based tags alongside
latestenables both rolling deployments and precise version tracking. GHA cache backend reduces build times on subsequent runs.
39-80: No action required — Dockerfile is correctly configured.The verification confirms the Dockerfile exists at the repository root and is properly structured to package
apps/apifor deployment. The multi-stage build correctly:
- Builds the shared package and API in the builder stage
- Copies built artifacts to the production image
- Generates the Prisma client at runtime
- Exposes port 4000 and runs the API with
CMD ["node", "dist/index.js"]The build context (
.) in the docker-build-and-push job aligns correctly with the Dockerfile structure.
|
nice work! @Prasad-D-Ware i'll check it soon and will come back to you! |
|
let me know if there are any changes needed. Thankyou! |
Solves : #145 CI/CD pipeline
Purpose: Automates testing, building, and deployment for both frontend and backend 1.
When It Runs
On Pull Requests: Validates code quality
On Main Branch: Validates + deploys to production
Pipeline Steps
1. Build & Validation Job
Install dependencies → Run linter → Build all packages
What: Ensures code compiles and follows style guidelines
Why: Catches errors before they reach production
2. Backend Deployment Job (main branch only)
Build Docker image → Push to GitHub Registry (ghcr.io)
What: Packages the API (apps/api) into a Docker container
Why: Ready for deployment to Railway or any container platform
3. Frontend Deployment Job (main branch only)
Build Next.js app → Deploy to Vercel
What: Deploys the web app (apps/web) to Vercel
Why: Provides fast, global CDN-backed hosting for the frontend
Required Setup
Add these secrets in GitHub repo settings:
VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID - For frontend deployment
GITHUB_TOKEN - Auto-provided for Docker registry access
Result
✅ Every merge to main auto-deploys frontend and backend
✅ No manual deployment needed
Summary by CodeRabbit