Skip to content

Commit 58cfc6a

Browse files
authored
Merge pull request #43 from DeviceLife-Official/feature/42-deploy-preview
deploy: 배포 pr 미리보기 기능 설정
2 parents f605892 + f6a96e5 commit 58cfc6a

2 files changed

Lines changed: 46 additions & 1 deletion

File tree

.github/workflows/preview.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Preview
2+
3+
on:
4+
pull_request:
5+
branches: ['develop']
6+
7+
jobs:
8+
vercel-preview:
9+
runs-on: ubuntu-latest
10+
11+
env:
12+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
13+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Install Vercel CLI
18+
run: npm install --global vercel@latest && npm install --global pnpm
19+
- name: Get Vercel Environment Variables
20+
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
21+
- name: Build Project Artifacts
22+
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
23+
- name: Deploy Project Artifacts to Vercel
24+
id: deploy
25+
26+
run: |
27+
28+
vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} > vercel-output.txt
29+
echo "preview_url=$(cat vercel-output.txt)" >> $GITHUB_OUTPUT
30+
31+
- name: Comment PR with Preview URL
32+
uses: thollander/actions-comment-pull-request@v2
33+
with:
34+
message: |
35+
✅ PREVIEW ${{ steps.deploy.outputs.preview_url }}
36+
37+
permissions:
38+
contents: read
39+
pages: write
40+
deployments: write
41+
id-token: write
42+
issues: write
43+
pull-requests: write

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@ dist-ssr
2323
*.njsproj
2424
*.sln
2525
*.sw?
26-
.env
26+
.env
27+
.vercel
28+
.env*.local

0 commit comments

Comments
 (0)