@@ -18,61 +18,75 @@ jobs:
1818 steps :
1919 - uses : actions/checkout@v4
2020
21- - uses : actions/setup-node@v4
21+ # Setup Node with npm cache (package-lock.json)
22+ - name : Setup Node (npm cache)
23+ uses : actions/setup-node@v4
2224 with :
2325 node-version : 20
24- - uses : pnpm/action-setup@v4
25- with :
26- version : 9
26+ cache : ' npm'
27+ cache-dependency-path : ' package-lock.json'
2728
28- - uses : actions/setup-node@v4
29- with :
30- node-version : 20
31- cache : ' pnpm'
32- cache-dependency-path : ' pnpm-lock.yaml'
29+ - name : Show versions
30+ run : |
31+ node -v
32+ npm -v
33+
34+ - name : Install dependencies
35+ run : npm ci
36+
37+ - name : Lint (if present)
38+ run : npm run --if-present lint
3339
34- - run : pnpm i --frozen-lockfile
40+ - name : Typecheck (if present)
41+ run : npm run --if-present typecheck
3542
36- - run : pnpm run --if-present lint
37- - run : pnpm run --if-present typecheck
38- - run : pnpm run --if-present test -- --passWithNoTests
43+ - name : Test (if present)
44+ run : npm run --if-present test -- --passWithNoTests
3945
40- - run : pnpm run build
46+ - name : Build
47+ run : npm run build
4148
4249 vercel-preview :
4350 if : ${{ github.event.pull_request.head.repo.full_name == github.repository && !github.event.pull_request.draft }}
4451 needs : checks
4552 runs-on : ubuntu-latest
46-
53+
4754 env :
4855 VERCEL_ORG_ID : ${{ secrets.VERCEL_ORG_ID }}
4956 VERCEL_PROJECT_ID : ${{ secrets.VERCEL_PROJECT_ID }}
5057
5158 steps :
5259 - uses : actions/checkout@v4
5360
54- - uses : actions/setup-node@v4
55- with : { node-version: 20 }
56- - uses : pnpm/action-setup@v4
57- with : { version: 9 }
58- - run : pnpm -v
59- - uses : actions/setup-node@v4
61+ - name : Setup Node (npm cache)
62+ uses : actions/setup-node@v4
6063 with :
6164 node-version : 20
62- cache : ' pnpm'
63- cache-dependency-path : ' pnpm-lock.yaml'
65+ cache : ' npm'
66+ cache-dependency-path : ' package-lock.json'
67+
68+ - name : Show versions
69+ run : |
70+ node -v
71+ npm -v
6472
65-
6673 - name : Install Vercel CLI
6774 run : npm install --global vercel@latest
75+
6876 - name : Pull Vercel Env (preview)
77+ env :
78+ VERCEL_TOKEN : ${{ secrets.VERCEL_TOKEN }}
6979 run : vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
80+
7081 - name : Build Project Artifacts (prebuilt)
82+ env :
83+ VERCEL_TOKEN : ${{ secrets.VERCEL_TOKEN }}
7184 run : vercel build --token=${{ secrets.VERCEL_TOKEN }}
7285
7386 - name : Deploy Preview
7487 id : deploy
75-
88+ env :
89+ VERCEL_TOKEN : ${{ secrets.VERCEL_TOKEN }}
7690 run : |
7791 url=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})
7892 echo "preview_url=$url" >> $GITHUB_OUTPUT
0 commit comments