-
Notifications
You must be signed in to change notification settings - Fork 2
83 lines (68 loc) · 2.13 KB
/
ci-cd.yml
File metadata and controls
83 lines (68 loc) · 2.13 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
82
83
name: CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
NODE_VERSION: "20"
POSTHOG_KEY: ${{ secrets.POSTHOG_KEY }}
jobs:
build:
name: Build
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: "pnpm-lock.yaml"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
env:
NEXT_PUBLIC_POSTHOG_KEY: ${{ secrets.POSTHOG_KEY }}
NEXT_PUBLIC_POSTHOG_HOST: ${{ secrets.POSTHOG_HOST || 'https://app.posthog.com' }}
deploy:
name: Deploy
needs: build
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: "pnpm-lock.yaml"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
env:
NEXT_PUBLIC_POSTHOG_KEY: ${{ secrets.POSTHOG_KEY }}
NEXT_PUBLIC_POSTHOG_HOST: ${{ secrets.POSTHOG_HOST || 'https://app.posthog.com' }}
# Add your deployment steps here
# Example for Vercel:
# - name: Deploy to Vercel
# uses: amondnet/vercel-action@v20
# with:
# vercel-token: ${{ secrets.VERCEL_TOKEN }}
# vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
# vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
# working-directory: ./
# vercel-args: '--prod'