-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (48 loc) · 1.54 KB
/
publish_website.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
on:
push:
branches:
- main
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Every day at midnight
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
name: Publish to Cloudflare Pages
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Migrate production database with prisma
run: bash scripts/migrate.sh
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
- name: Install JS dependencies
run: bun install
working-directory: website
- name: Generate Prisma Client
# Working directory is "./" on purpose!
run: bunx prisma generate
- name: Build
run: bun run build
working-directory: website
env:
NODE_ENV: production
DATABASE_URL: ${{ secrets.DATABASE_URL }}
PUBLIC_SERVER_URL: ${{ secrets.PUBLIC_SERVER_URL }}
PUBLIC_TURNSTILE_SITEKEY: ${{ secrets.PUBLIC_TURNSTILE_SITEKEY }}
PUBLIC_GTAG: ${{ secrets.PUBLIC_GTAG }}
- name: Publish to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy dist/client --project-name=${{ secrets.CLOUDFLARE_PAGES_PROJECT_NAME }} --branch=main
workingDirectory: website
packageManager: bun