|
7 | 7 | - feat/cd |
8 | 8 |
|
9 | 9 | 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 | | - |
49 | 10 | deploy: |
50 | | - name: Deploy to AWS Lambda |
51 | | - needs: validate |
52 | 11 | runs-on: ubuntu-latest |
53 | 12 | steps: |
54 | | - - name: Download build artifact |
55 | | - uses: actions/download-artifact@v4 |
56 | | - with: |
57 | | - name: build-artifact |
58 | | - |
59 | 13 | - name: Install Serverless Framework |
60 | 14 | run: npm install -g serverless@3.38.0 |
61 | 15 |
|
62 | | - - name: Install Prisma CLI |
63 | | - run: npm install -g prisma |
| 16 | + - name: Install dependencies |
| 17 | + run: yarn install --frozen-lockfile |
64 | 18 |
|
65 | 19 | - name: Run Prisma migrations |
66 | 20 | run: npx prisma migrate deploy 2>&1 | grep -v 'Datasource "db":' | grep -v 'PostgreSQL database' |
|
73 | 27 | echo "REFRESH_TOKEN_SECRET=${{ secrets.REFRESH_TOKEN_SECRET }}" >> .env |
74 | 28 | echo "DB_URL=${{ secrets.DB_URL }}" >> .env |
75 | 29 |
|
| 30 | + - name: Run build |
| 31 | + run: yarn build |
| 32 | + |
76 | 33 | - name: Configure serverless credentials |
77 | 34 | run: serverless config credentials --provider aws --key ${{ secrets.AWS_ACCESS_KEY_ID }} --secret ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
78 | 35 |
|
79 | 36 | - name: Deploy serverless app |
80 | | - run: npx serverless deploy 2>&1 | grep -v 'endpoint:' |
| 37 | + run: serverless deploy 2>&1 | grep -v 'endpoint:' |
0 commit comments