-
-
Notifications
You must be signed in to change notification settings - Fork 116
81 lines (77 loc) · 2.73 KB
/
Copy pathexample-nextjs.yml
File metadata and controls
81 lines (77 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: example - next.js
on:
push:
branches:
- master
- feature/*
pull_request_target:
jobs:
static:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup pnpm
uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
with:
version: 10.15.0
- name: Setup Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 24
cache: pnpm
- run: |
pnpm install --frozen-lockfile
pnpm exec vercel pull --yes --token=${VERCEL_TOKEN}
working-directory: example/nextjs
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_NEXTJS }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
- run: |
pnpm exec vercel build
if: github.event_name == 'pull_request_target'
working-directory: example/nextjs
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_NEXTJS }}
- uses: ./
id: now-deployment-staging
if: github.event_name == 'pull_request_target'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID_NEXTJS }}
vercel-args: --prebuilt
working-directory: example/nextjs
alias-domains: |
staging.nextjs.vercel-action.amond.dev
pr-{{PR_NUMBER}}.nextjs.vercel-action.amond.dev
- name: production or not
id: prod_or_not
run: |
if [ "$REF" == 'refs/heads/master' ]
then
echo "vercel-args=--prod --prebuilt" >> $GITHUB_OUTPUT
else
echo "vercel-args=--prebuilt" >> $GITHUB_OUTPUT
fi
env:
REF: ${{ github.ref }}
- run: |
pnpm exec vercel build --prod
if: github.event_name == 'push'
working-directory: example/nextjs
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_NEXTJS }}
- uses: ./
id: now-deployment-production
if: github.event_name == 'push'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID_NEXTJS }}
vercel-args: ${{ steps.prod_or_not.outputs.vercel-args }}
working-directory: example/nextjs
alias-domains: |
{{BRANCH}}.nextjs.vercel-action.amond.dev