Skip to content

.github/workflows/publish_website.yml #605

.github/workflows/publish_website.yml

.github/workflows/publish_website.yml #605

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