1
1
name : ' Deploy cloudflare'
2
2
description : ' Deploy GitBook to Cloudflare'
3
3
inputs :
4
+ opItem :
5
+ description : ' 1Password item to load secrets from'
6
+ required : true
7
+ opServiceAccount :
8
+ description : ' 1Password service account token'
9
+ required : true
4
10
apiToken :
5
11
description : ' Cloudflare API token'
6
12
required : true
7
13
accountId :
8
14
description : ' Cloudflare account ID'
9
15
required : true
10
16
environment :
11
- description : ' Environment to deploy to'
17
+ description : ' Cloudflare environment to deploy to (staging, production, preview) '
12
18
required : true
13
19
deploy :
14
20
description : ' Deploy as main version for all traffic instead of uploading versions'
15
21
required : true
16
- NEXT_SERVER_ACTIONS_ENCRYPTION_KEY :
17
- description : ' Next server actions encryption key'
18
- required : true
19
- GITBOOK_URL :
20
- description : ' GitBook URL'
21
- required : true
22
- GITBOOK_SECRET :
23
- description : ' GitBook secret'
24
- required : true
25
- GITBOOK_APP_URL :
26
- description : ' GitBook app URL'
27
- required : false
28
- GITBOOK_API_URL :
29
- description : ' GitBook API URL'
30
- required : false
31
- GITBOOK_INTEGRATIONS_HOST :
32
- description : ' GitBook integrations host'
33
- required : false
34
- GITBOOK_IMAGE_RESIZE_SIGNING_KEY :
35
- description : ' GitBook image resize signing key'
36
- required : true
37
- GITBOOK_IMAGE_RESIZE_URL :
38
- description : ' GitBook image resize URL'
39
- required : true
40
- GITBOOK_ICONS_URL :
41
- description : ' GitBook icons URL'
42
- required : true
43
- GITBOOK_ICONS_TOKEN :
44
- description : ' GitBook icons token'
45
- required : true
46
- GITBOOK_ASSETS_PREFIX :
47
- description : ' GitBook assets prefix'
48
- required : false
49
22
outputs :
50
23
deployment-url :
51
24
description : " Deployment URL"
@@ -60,21 +33,25 @@ runs:
60
33
shell : bash
61
34
env :
62
35
PUPPETEER_SKIP_DOWNLOAD : 1
36
+ - name : Load secret
37
+ uses : 1password/load-secrets-action@v2
38
+ env :
39
+ OP_SERVICE_ACCOUNT_TOKEN : ${{ inputs.opServiceAccount }}
40
+ GITBOOK_URL : ${{ inputs.opItem }}/GITBOOK_URL
41
+ GITBOOK_ICONS_URL : ${{ inputs.opItem }}/GITBOOK_ICONS_URL
42
+ GITBOOK_ICONS_TOKEN : ${{ inputs.opItem }}/GITBOOK_ICONS_TOKEN
43
+ NEXT_SERVER_ACTIONS_ENCRYPTION_KEY : ${{ inputs.opItem }}/NEXT_SERVER_ACTIONS_ENCRYPTION_KEY
44
+ GITBOOK_SECRET : ${{ inputs.opItem }}/GITBOOK_SECRET
45
+ GITBOOK_APP_URL : ${{ inputs.opItem }}/GITBOOK_APP_URL
46
+ GITBOOK_API_URL : ${{ inputs.opItem }}/GITBOOK_API_URL
47
+ GITBOOK_API_TOKEN : ${{ inputs.opItem }}/GITBOOK_API_TOKEN
48
+ GITBOOK_INTEGRATIONS_HOST : ${{ inputs.opItem }}/GITBOOK_INTEGRATIONS_HOST
49
+ GITBOOK_IMAGE_RESIZE_SIGNING_KEY : ${{ inputs.opItem }}/GITBOOK_IMAGE_RESIZE_SIGNING_KEY
50
+ GITBOOK_IMAGE_RESIZE_URL : ${{ inputs.opItem }}/GITBOOK_IMAGE_RESIZE_URL
51
+ GITBOOK_ASSETS_PREFIX : ${{ inputs.opItem }}/GITBOOK_ASSETS_PREFIX
63
52
- name : Build worker
64
53
run : bun run turbo build:v2:cloudflare
65
54
shell : bash
66
- env :
67
- NEXT_SERVER_ACTIONS_ENCRYPTION_KEY : ${{ inputs.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY }}
68
- GITBOOK_URL : ${{ inputs.GITBOOK_URL }}
69
- GITBOOK_SECRET : ${{ inputs.GITBOOK_SECRET }}
70
- GITBOOK_APP_URL : ${{ inputs.GITBOOK_APP_URL }}
71
- GITBOOK_API_URL : ${{ inputs.GITBOOK_API_URL }}
72
- GITBOOK_INTEGRATIONS_HOST : ${{ inputs.GITBOOK_INTEGRATIONS_HOST }}
73
- GITBOOK_IMAGE_RESIZE_SIGNING_KEY : ${{ inputs.GITBOOK_IMAGE_RESIZE_SIGNING_KEY }}
74
- GITBOOK_IMAGE_RESIZE_URL : ${{ inputs.GITBOOK_IMAGE_RESIZE_URL }}
75
- GITBOOK_ICONS_URL : ${{ inputs.GITBOOK_ICONS_URL }}
76
- GITBOOK_ICONS_TOKEN : ${{ inputs.GITBOOK_ICONS_TOKEN }}
77
- GITBOOK_ASSETS_PREFIX : ${{ inputs.GITBOOK_ASSETS_PREFIX }}
78
55
- id : deploy
79
56
name : Deploy to Cloudflare
80
57
uses :
cloudflare/[email protected]
84
61
workingDirectory : ./
85
62
wranglerVersion : ' 3.112.0'
86
63
environment : ${{ inputs.environment }}
87
- command : ${{ inputs.deploy && 'deploy' || 'versions upload' }} --config ./packages/gitbook-v2/wrangler.toml
64
+ command : ${{ fromJSON( inputs.deploy) == true && 'deploy' || 'versions upload' }} --config ./packages/gitbook-v2/wrangler.toml
88
65
- name : Outputs
89
66
shell : bash
90
67
env :
0 commit comments