-
Notifications
You must be signed in to change notification settings - Fork 4
80 lines (70 loc) · 2.4 KB
/
Copy pathproduction.yml
File metadata and controls
80 lines (70 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# ============================================================
# Production 배포 워크플로우
# develop → main PR이 merge될 때 실행
# ============================================================
name: Deploy Production
on:
push:
branches: [main]
# Vercel 인증 환경변수
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
jobs:
deploy-production:
name: Deploy Production
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
# 레포지토리 코드를 가상머신에 체크아웃
- uses: actions/checkout@v4
# pnpm 설치 (pnpm/action-setup)
- name: Install pnpm
uses: pnpm/action-setup@v5
with:
version: 10
# Node.js 환경 설정 (pnpm 캐싱 사용)
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
# Vercel CLI 설치
- name: Install Vercel CLI
run: pnpm install -g vercel@latest
# Production Build
- name: Production Build
run: |
vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
# Production Deploy
- name: Deploy to Production
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
# 배포 완료 시각 저장 자동 세팅
- name: Get current Time
uses: josStorer/get-current-time@v2
id: current-time
with:
format: "YYYY년 MM월 DD일 HH시 mm분"
utcOffset: "+09:00"
# Production 댓글 추가
- name: Comment PR
uses: actions/github-script@v7
with:
script: |
const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
owner: context.repo.owner,
repo: context.repo.repo,
commit_sha: context.sha,
});
if (prs.length > 0) {
await github.rest.issues.createComment({
issue_number: prs[0].number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `⏰ 배포 시각: ${{ steps.current-time.outputs.formattedTime }}`
});
}