-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (73 loc) · 2.5 KB
/
docker-image.yml
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
82
83
84
85
name: Next.js CI/CD Workflow
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository
- name: Checkout code
uses: actions/checkout@v4
# Step 2: Set up Node.js
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 16 # Specify the Node.js version
cache: 'npm'
# Step 3: Install dependencies
- name: Install dependencies
run: npm install
# Step 4: Build the Next.js project
- name: Build the Next.js application
run: npm run build
env:
UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}
UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REST_TOKEN }}
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
PUSHER_APP_ID: ${{ secrets.PUSHER_APP_ID }}
NEXT_PUBLIC_PUSHER_KEY: ${{ secrets.NEXT_PUBLIC_PUSHER_KEY }}
PUSHER_SECRET: ${{ secrets.PUSHER_SECRET }}
PUSHER_CLUSTER: ${{ secrets.PUSHER_CLUSTER }}
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }}
# Step 5: Upload build artifacts (optional)
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: nextjs-build
path: .next
deploy:
runs-on: ubuntu-latest
needs: build
steps:
# Step 1: Checkout code
- name: Checkout code
uses: actions/checkout@v4
# Step 2: Setup Node.js
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 16 # Specify the Node.js version
cache: 'npm'
# Step 3: Download build artifacts
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: nextjs-build
# Step 4: Deploy to Vercel
- name: Deploy to Vercel
run: npx vercel --prod
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}
UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
PUSHER_APP_ID: ${{ secrets.PUSHER_APP_ID }}
NEXT_PUBLIC_PUSHER_KEY: ${{ secrets.NEXT_PUBLIC_PUSHER_KEY }}
PUSHER_SECRET: ${{ secrets.PUSHER_SECRET }}
PUSHER_CLUSTER: ${{ secrets.PUSHER_CLUSTER }}
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }}