Skip to content

Merge pull request #26 from gabrielluciano/frontend/angular-18-update #25

Merge pull request #26 from gabrielluciano/frontend/angular-18-update

Merge pull request #26 from gabrielluciano/frontend/angular-18-update #25

name: Personal Blog Frontend Test and Deploy CI
on:
push:
branches: ["main"]
paths:
- "frontend/**"
workflow_dispatch:
env:
APP_FOLDER: frontend
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
jobs:
tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.APP_FOLDER }}
steps:
- uses: actions/checkout@v4
- name: Set up Node 20
uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: npm
cache-dependency-path: "./frontend/package-lock.json"
- name: Install dependencies
run: npm ci
- name: Check lint rules
run: npm run lint
- name: Check coding formatting rules
run: npx prettier --check .
- name: Run tests
run: npm test
deploy:
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}