92 lines
2.6 KiB
YAML
92 lines
2.6 KiB
YAML
on:
|
|
push:
|
|
branches: [main, dev]
|
|
|
|
name: ☁️ Deploy to Cloudflare Workers
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
jobs:
|
|
deploy:
|
|
name: Build & Deploy
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
node-version: [lts/*]
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
with:
|
|
lfs: true
|
|
|
|
- name: Checkout LFS objects
|
|
run: git lfs checkout
|
|
|
|
- name: Cache turbo build setup
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: .turbo
|
|
key: ${{ runner.os }}-turbo-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ runner.os }}-turbo-
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: "pnpm"
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
|
|
- name: Build desktop web (SPA)
|
|
run: pnpm exec turbo run Folo#build:web
|
|
|
|
- name: Build SSR Worker
|
|
working-directory: apps/ssr
|
|
run: pnpm run build:worker
|
|
|
|
- name: Copy WASM file
|
|
run: cp node_modules/@resvg/resvg-wasm/index_bg.wasm apps/ssr/dist/worker/resvg.wasm
|
|
|
|
- name: Build Landing Worker
|
|
run: pnpm exec turbo run @follow/landing#cf:build
|
|
|
|
- name: Deploy to Cloudflare (dev)
|
|
if: github.ref == 'refs/heads/dev'
|
|
uses: cloudflare/wrangler-action@v3
|
|
with:
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
workingDirectory: apps/ssr
|
|
command: deploy --env dev
|
|
|
|
- name: Deploy Landing to Cloudflare (dev)
|
|
if: github.ref == 'refs/heads/dev'
|
|
uses: cloudflare/wrangler-action@v3
|
|
with:
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
workingDirectory: apps/landing
|
|
command: deploy --env dev
|
|
|
|
- name: Deploy to Cloudflare (prod)
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: cloudflare/wrangler-action@v3
|
|
with:
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
workingDirectory: apps/ssr
|
|
command: deploy
|
|
|
|
- name: Deploy Landing to Cloudflare (prod)
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: cloudflare/wrangler-action@v3
|
|
with:
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
workingDirectory: apps/landing
|
|
command: deploy
|