-
-
Notifications
You must be signed in to change notification settings - Fork 34
45 lines (38 loc) · 1.3 KB
/
deploy.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
name: Build and Deploy - Cloudflare Pages
on:
workflow_call:
inputs:
CLOUDFLARE_ENV:
required: false
type: string
default: ${{ contains(github.ref, 'main') && 'prod' || contains(github.ref, 'staging') && 'staging' || 'dev'}}
NODE_ENV:
required: false
type: string
default: ${{ contains(github.ref, 'main') && 'production' || contains(github.ref, 'staging') && 'staging' || 'development'}}
APP_NAME:
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.9
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Install Dependencies
run: pnpm install
- name: Build
run: pnpm build:${{ inputs.NODE_ENV }} --filter=${{ inputs.APP_NAME }}
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
packageManager: pnpm
apiToken: ${{ secrets.CLOUDFLARE_PAGES_API_TOKEN }}
accountId: d8803c6a6253e9267bf1000ca69db18d
workingDirectory: 'apps/${{ inputs.APP_NAME }}'
command: pages deploy dist --project-name=${{ inputs.CLOUDFLARE_ENV }}-${{ inputs.APP_NAME }} --branch=main