Skip to content

Fix: Update CI workflow to remove pull request target #180

Fix: Update CI workflow to remove pull request target

Fix: Update CI workflow to remove pull request target #180

Workflow file for this run

name: Next.js CI/CD with Vercel
on:
push:
branches: [develop, main]
jobs:
build-and-deploy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml
# 💥 캐시 초기화 단계 추가
- name: Clean caches
run: |
rm -rf node_modules
rm -rf .next
pnpm store prune
- name: Install dependencies
run: pnpm install
- name: Build Next.js app
run: pnpm build
# main은 Production 배포
- name: Deploy to Vercel (Production)
if: github.ref == 'refs/heads/main'
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
working-directory: .
vercel-args: '--prod --force'
# develop은 Preview 배포 (항상 새 빌드)
- name: Deploy to Vercel (Preview)
if: github.ref == 'refs/heads/develop'
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
working-directory: .
vercel-args: '--force'