-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (52 loc) · 1.8 KB
/
Copy pathcf-pages-preview.yaml
File metadata and controls
60 lines (52 loc) · 1.8 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
# Workflow for deploying to Cloudflare Pages as Preview
name: Preview Deploy
on:
# Runs on pushes targeting the default branch
push:
branches: ['main', 'ssr-new-features']
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to Cloudflare Pages
permissions:
contents: read
deployments: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: 'pages'
cancel-in-progress: false
jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: cf-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 8
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Build artifact
run: |
pnpm run build
env:
PUBLIC_TYPESENSE_API_KEY: ${{ secrets.TYPESENSE_API_KEY }}
PUBLIC_TYPESENSE_HOST: ${{ secrets.TYPESENSE_HOST }}
PUBLIC_TYPESENSE_PROTOCOL: ${{ secrets.TYPESENSE_PROTOCOL }}
- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy build --project-name="cbfc-watch" --branch preview
gitHubToken: ${{ secrets.GITHUB_TOKEN }}