Skip to content

Backend/vps deployment #22

Backend/vps deployment

Backend/vps deployment #22

name: Personal Blog Frontend Test CI
on:
pull_request:
branches: ["main"]
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-preview:
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=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}