-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (66 loc) · 2.4 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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@v3
- name: Setup Python (This is needed for the DB Connection check)
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Sanity check for DB Connection
run: python scripts/check_db_connection.py
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'
cache: 'yarn'
cache-dependency-path: website/yarn.lock
- name: Migrate production database with prisma
run: bash scripts/migrate.sh
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
- name: Install Node.js dependencies
run: yarn install --frozen-lockfile
working-directory: website
- name: Generate Prisma Client
# Working directory is "./" on purpose!
run: npx prisma generate
- name: Build
run: yarn 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/[email protected]
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ secrets.CLOUDFLARE_PAGES_PROJECT_NAME }}
directory: dist/client
# Optional: Enable this if you want to have GitHub Deployments triggered
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
# Optional: Switch what branch you are publishing to.
# By default, this will be the branch which triggered this workflow
branch: main
# Optional: Change the working directory
workingDirectory: website
# Optional: Change the Wrangler version, allows you to point to a specific version or a tag such as `beta`
wranglerVersion: '3'