Merge pull request #18 from NegasiHaile/ci/cd #30
This file contains 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: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
# environment: Production | |
services: | |
mongodb: | |
image: mongo:latest | |
ports: | |
- 27017:27017 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18.x" | |
- name: Install server dependencies | |
working-directory: ./ | |
run: npm install | |
- name: Install client dependencies | |
working-directory: ./client | |
run: npm install | |
- name: Lint server | |
working-directory: ./ | |
run: npm run lint | |
- name: Lint client | |
working-directory: ./client | |
run: npm run lint | |
# - name: Run server tests | |
# working-directory: ./ | |
# run: npm test | |
# - name: Run client tests | |
# working-directory: ./client | |
# run: npm test | |
# Step 5: Install Vercel CLI | |
- name: Install Vercel CLI | |
run: npm install -g vercel | |
# Step 6: Deploy to Vercel | |
- name: Deploy to Vercel | |
env: | |
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} # Ensure this is referencing the correct GitHub secret | |
run: vercel --prod --token $VERCEL_TOKEN |