Skip to content

Commit 38ccacc

Browse files
committed
feat: build / deploy workflow 나눔
- npx prisma generate 는 삭제 -> yarn install 시 prisma 내부 postinstall 로 shcema에 따라 자동 생성
1 parent 9b5cb8b commit 38ccacc

File tree

2 files changed

+38
-49
lines changed

2 files changed

+38
-49
lines changed

.github/workflows/deploy.yml

Lines changed: 6 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,60 +7,14 @@ on:
77
- feat/cd
88

99
jobs:
10-
validate:
11-
name: Validate and Build
12-
runs-on: ubuntu-latest
13-
steps:
14-
- name: Checkout code
15-
uses: actions/checkout@v4
16-
17-
- name: Setup Node.js
18-
uses: actions/setup-node@v4
19-
with:
20-
node-version: '20'
21-
cache: 'yarn'
22-
23-
- name: Install dependencies
24-
run: yarn install
25-
26-
- name: Generate Prisma client
27-
run: npx prisma generate
28-
29-
- name: Lint code
30-
run: yarn lint
31-
32-
- name: Build project
33-
run: yarn build
34-
35-
- name: Upload build artifact
36-
uses: actions/upload-artifact@v4
37-
with:
38-
name: build-artifact
39-
path: |
40-
dist/
41-
node_modules/
42-
package.json
43-
yarn.lock
44-
serverless.yml
45-
prisma/
46-
src/
47-
retention-days: 1
48-
4910
deploy:
50-
name: Deploy to AWS Lambda
51-
needs: validate
5211
runs-on: ubuntu-latest
5312
steps:
54-
- name: Download build artifact
55-
uses: actions/download-artifact@v4
56-
with:
57-
name: build-artifact
58-
5913
- name: Install Serverless Framework
6014
run: npm install -g serverless@3.38.0
6115

62-
- name: Install Prisma CLI
63-
run: npm install -g prisma
16+
- name: Install dependencies
17+
run: yarn install --frozen-lockfile
6418

6519
- name: Run Prisma migrations
6620
run: npx prisma migrate deploy 2>&1 | grep -v 'Datasource "db":' | grep -v 'PostgreSQL database'
@@ -73,8 +27,11 @@ jobs:
7327
echo "REFRESH_TOKEN_SECRET=${{ secrets.REFRESH_TOKEN_SECRET }}" >> .env
7428
echo "DB_URL=${{ secrets.DB_URL }}" >> .env
7529
30+
- name: Run build
31+
run: yarn build
32+
7633
- name: Configure serverless credentials
7734
run: serverless config credentials --provider aws --key ${{ secrets.AWS_ACCESS_KEY_ID }} --secret ${{ secrets.AWS_SECRET_ACCESS_KEY }}
7835

7936
- name: Deploy serverless app
80-
run: npx serverless deploy 2>&1 | grep -v 'endpoint:'
37+
run: serverless deploy 2>&1 | grep -v 'endpoint:'

.github/workflows/validate.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Run build & test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- feat/cd
8+
9+
jobs:
10+
validate:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
cache: 'yarn'
21+
22+
- name: Install dependencies
23+
run: yarn install --frozen-lockfile
24+
25+
- name: Lint code
26+
run: yarn lint
27+
28+
# - name: Run test
29+
# run: yarn test
30+
31+
- name: Build project
32+
run: yarn build

0 commit comments

Comments
 (0)