1+ name : ' Deploy cloudflare'
2+ description : ' Deploy GitBook to Cloudflare'
3+ inputs :
4+ apiToken :
5+ description : ' Cloudflare API token'
6+ required : true
7+ accountId :
8+ description : ' Cloudflare account ID'
9+ required : true
10+ environment :
11+ description : ' Environment to deploy to'
12+ required : true
13+ NEXT_SERVER_ACTIONS_ENCRYPTION_KEY :
14+ description : ' Next server actions encryption key'
15+ required : true
16+ GITBOOK_URL :
17+ description : ' GitBook URL'
18+ required : true
19+ GITBOOK_APP_URL :
20+ description : ' GitBook app URL'
21+ required : false
22+ GITBOOK_API_URL :
23+ description : ' GitBook API URL'
24+ required : false
25+ GITBOOK_INTEGRATIONS_HOST :
26+ description : ' GitBook integrations host'
27+ required : false
28+ GITBOOK_IMAGE_RESIZE_SIGNING_KEY :
29+ description : ' GitBook image resize signing key'
30+ required : true
31+ GITBOOK_IMAGE_RESIZE_URL :
32+ description : ' GitBook image resize URL'
33+ required : true
34+ GITBOOK_ICONS_URL :
35+ description : ' GitBook icons URL'
36+ required : true
37+ GITBOOK_ICONS_TOKEN :
38+ description : ' GitBook icons token'
39+ required : true
40+ GITBOOK_ASSETS_PREFIX :
41+ description : ' GitBook assets prefix'
42+ required : false
43+ outputs :
44+ deployment-url :
45+ description : " Deployment URL"
46+ value : ${{ steps.deploy.outputs.deployment-url }}
47+ runs :
48+ using : ' composite'
49+ steps :
50+ - name : Setup Bun
51+ uses : ./.github/composite/setup-bun
52+ - name : Install dependencies
53+ run : bun install --frozen-lockfile
54+ shell : bash
55+ env :
56+ PUPPETEER_SKIP_DOWNLOAD : 1
57+ - name : Build worker
58+ run : bun run turbo build:v2:cloudflare
59+ shell : bash
60+ env :
61+ NEXT_SERVER_ACTIONS_ENCRYPTION_KEY : ${{ inputs.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY }}
62+ GITBOOK_URL : ${{ inputs.GITBOOK_URL }}
63+ GITBOOK_APP_URL : ${{ inputs.GITBOOK_APP_URL }}
64+ GITBOOK_API_URL : ${{ inputs.GITBOOK_API_URL }}
65+ GITBOOK_INTEGRATIONS_HOST : ${{ inputs.GITBOOK_INTEGRATIONS_HOST }}
66+ GITBOOK_IMAGE_RESIZE_SIGNING_KEY : ${{ inputs.GITBOOK_IMAGE_RESIZE_SIGNING_KEY }}
67+ GITBOOK_IMAGE_RESIZE_URL : ${{ inputs.GITBOOK_IMAGE_RESIZE_URL }}
68+ GITBOOK_ICONS_URL : ${{ inputs.GITBOOK_ICONS_URL }}
69+ GITBOOK_ICONS_TOKEN : ${{ inputs.GITBOOK_ICONS_TOKEN }}
70+ GITBOOK_ASSETS_PREFIX : ${{ inputs.GITBOOK_ASSETS_PREFIX }}
71+ - id : deploy
72+ name : Deploy to Cloudflare
73+ uses : cloudflare/wrangler-action@v3.14.0
74+ with :
75+ apiToken : ${{ inputs.apiToken }}
76+ accountId : ${{ inputs.accountId }}
77+ workingDirectory : ./
78+ wranglerVersion : ' 3.112.0'
79+ environment : ${{ inputs.environment }}
80+ command : ${{ inputs.environment == 'production' && 'deploy' || 'versions upload' }} --config ./packages/gitbook-v2/wrangler.toml
81+ - name : Outputs
82+ shell : bash
83+ env :
84+ DEPLOYMENT_URL : ${{ steps.deploy.outputs.deployment-url }}
85+ run : |
86+ echo "URL: ${{ steps.deploy.outputs.deployment-url }}"
0 commit comments