Skip to content

Commit f5f051d

Browse files
committed
refactor: preview, production deploy 설정 (#122)
1 parent 31f9ddb commit f5f051d

File tree

2 files changed

+74
-21
lines changed

2 files changed

+74
-21
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Deploy to Preview
2+
3+
env:
4+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
5+
6+
on:
7+
pull_request:
8+
types:
9+
- closed
10+
branches:
11+
- develop
12+
13+
jobs:
14+
project-build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup node
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 18
24+
cache: "yarn"
25+
26+
- name: Set yarn version
27+
id: set-version
28+
run: |
29+
yarn set version 4.1.1
30+
echo "YARN_VERSION=$(yarn -v)" >> $GITHUB_OUTPUT
31+
32+
- name: Yarn cache - PnP
33+
uses: actions/cache@v4
34+
with:
35+
path: |
36+
.yarn/cache
37+
.pnp.*
38+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ steps.set-version.outputs.YARN_VERSION }}
39+
restore-keys: |
40+
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-
41+
42+
- name: Install dependencies
43+
run: yarn
44+
45+
- name: Run build
46+
run: yarn build
47+
48+
deploy-to-vercel-preview:
49+
runs-on: ubuntu-latest
50+
needs: project-build
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v4
54+
55+
- name: Setup node
56+
uses: actions/setup-node@v4
57+
with:
58+
node-version: 18
59+
cache: "yarn"
60+
61+
- name: Install dependencies
62+
run: yarn
63+
64+
- name: Deploy to Vercel Preview
65+
run: |
66+
npm install --global vercel@latest
67+
vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
68+
vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
69+
vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} --alias misik-web-develop.vercel.app
Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy
1+
name: Deploy to Production
22

33
env:
44
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
@@ -8,7 +8,7 @@ on:
88
types:
99
- closed
1010
branches:
11-
- develop
11+
- main
1212

1313
jobs:
1414
project-build:
@@ -45,7 +45,7 @@ jobs:
4545
- name: Run build
4646
run: yarn build
4747

48-
deploy-to-vercel:
48+
deploy-to-vercel-production:
4949
runs-on: ubuntu-latest
5050
needs: project-build
5151
steps:
@@ -58,28 +58,12 @@ jobs:
5858
node-version: 18
5959
cache: "yarn"
6060

61-
- name: Set yarn version
62-
id: set-version
63-
run: |
64-
yarn set version 4.1.1
65-
echo "YARN_VERSION=$(yarn -v)" >> $GITHUB_OUTPUT
66-
67-
- name: Yarn cache - PnP
68-
uses: actions/cache@v4
69-
with:
70-
path: |
71-
.yarn/cache
72-
.pnp.*
73-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ steps.set-version.outputs.YARN_VERSION }}
74-
restore-keys: |
75-
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-
76-
7761
- name: Install dependencies
7862
run: yarn
7963

80-
- name: Deploy to Vercel
64+
- name: Deploy to Vercel Production
8165
run: |
8266
npm install --global vercel@latest
8367
vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
8468
vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
85-
vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
69+
vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} --alias misik-web.vercel.app

0 commit comments

Comments
 (0)