File tree Expand file tree Collapse file tree 5 files changed +27
-2
lines changed
composite/deploy-cloudflare Expand file tree Collapse file tree 5 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,18 @@ inputs:
10
10
environment :
11
11
description : ' Environment to deploy to'
12
12
required : true
13
+ deploy :
14
+ description : ' Deploy as main version for all traffic instead of uploading versions'
15
+ required : true
13
16
NEXT_SERVER_ACTIONS_ENCRYPTION_KEY :
14
17
description : ' Next server actions encryption key'
15
18
required : true
16
19
GITBOOK_URL :
17
20
description : ' GitBook URL'
18
21
required : true
22
+ GITBOOK_SECRET :
23
+ description : ' GitBook secret'
24
+ required : true
19
25
GITBOOK_APP_URL :
20
26
description : ' GitBook app URL'
21
27
required : false
60
66
env :
61
67
NEXT_SERVER_ACTIONS_ENCRYPTION_KEY : ${{ inputs.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY }}
62
68
GITBOOK_URL : ${{ inputs.GITBOOK_URL }}
69
+ GITBOOK_SECRET : ${{ inputs.GITBOOK_SECRET }}
63
70
GITBOOK_APP_URL : ${{ inputs.GITBOOK_APP_URL }}
64
71
GITBOOK_API_URL : ${{ inputs.GITBOOK_API_URL }}
65
72
GITBOOK_INTEGRATIONS_HOST : ${{ inputs.GITBOOK_INTEGRATIONS_HOST }}
77
84
workingDirectory : ./
78
85
wranglerVersion : ' 3.112.0'
79
86
environment : ${{ inputs.environment }}
80
- command : ${{ inputs.environment == 'production' && 'deploy' || 'versions upload' }} --config ./packages/gitbook-v2/wrangler.toml
87
+ command : ${{ inputs.deploy && 'deploy' || 'versions upload' }} --config ./packages/gitbook-v2/wrangler.toml
81
88
- name : Outputs
82
89
shell : bash
83
90
env :
Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ jobs:
103
103
uses : ./.github/composite/deploy-cloudflare
104
104
with :
105
105
environment : ${{ github.ref == 'refs/heads/main' && 'production' || 'preview' }}
106
+ deploy : ${{ github.ref == 'refs/heads/main' }}
106
107
apiToken : ${{ secrets.CLOUDFLARE_API_TOKEN }}
107
108
accountId : ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
108
109
NEXT_SERVER_ACTIONS_ENCRYPTION_KEY : ${{ secrets.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY }}
@@ -111,13 +112,14 @@ jobs:
111
112
GITBOOK_IMAGE_RESIZE_URL : ${{ vars.GITBOOK_IMAGE_RESIZE_URL }}
112
113
GITBOOK_ICONS_URL : ${{ vars.GITBOOK_ICONS_URL }}
113
114
GITBOOK_ICONS_TOKEN : ${{ vars.GITBOOK_ICONS_TOKEN }}
115
+ GITBOOK_SECRET : ${{ github.ref == 'refs/heads/main' && secrets.PRODUCTION_GITBOOK_SECRET|| '' }}
114
116
- name : Outputs
115
117
run : |
116
118
echo "URL: ${{ steps.deploy.outputs.deployment-url }}"
117
119
comment-deployments :
118
120
runs-on : ubuntu-latest
119
121
name : Comment Deployments (preview)
120
- if : always()
122
+ if : always() && !startsWith(github.ref, 'refs/heads/main')
121
123
needs :
122
124
- deploy-v1-cloudflare
123
125
- deploy-v2-vercel
Original file line number Diff line number Diff line change @@ -35,10 +35,12 @@ jobs:
35
35
uses : ./.github/composite/deploy-cloudflare
36
36
with :
37
37
environment : staging
38
+ deploy : true
38
39
apiToken : ${{ secrets.CLOUDFLARE_API_TOKEN }}
39
40
accountId : ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
40
41
NEXT_SERVER_ACTIONS_ENCRYPTION_KEY : ${{ secrets.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY }}
41
42
GITBOOK_URL : ${{ vars.STAGING_2C_GITBOOK_URL }}
43
+ GITBOOK_SECRET : ${{ secrets.STAGING_GITBOOK_SECRET }}
42
44
GITBOOK_APP_URL : https://app.gitbook-staging.com
43
45
GITBOOK_API_URL : https://api.gitbook-staging.com
44
46
GITBOOK_INTEGRATIONS_HOST : https://integrations.gitbook-staging.com
Original file line number Diff line number Diff line change @@ -11,6 +11,12 @@ const nextConfig = {
11
11
env : {
12
12
BUILD_VERSION : ( process . env . GITHUB_SHA ?? '' ) . slice ( 0 , 7 ) ,
13
13
GITBOOK_URL : process . env . GITBOOK_URL ,
14
+ GITBOOK_SECRET : process . env . GITBOOK_SECRET ,
15
+ GITBOOK_API_URL : process . env . GITBOOK_API_URL ,
16
+ GITBOOK_APP_URL : process . env . GITBOOK_APP_URL ,
17
+ GITBOOK_INTEGRATIONS_HOST : process . env . GITBOOK_INTEGRATIONS_HOST ,
18
+ GITBOOK_IMAGE_RESIZE_SIGNING_KEY : process . env . GITBOOK_IMAGE_RESIZE_SIGNING_KEY ,
19
+ GITBOOK_IMAGE_RESIZE_URL : process . env . GITBOOK_IMAGE_RESIZE_URL ,
14
20
GITBOOK_ASSETS_PREFIX : process . env . GITBOOK_ASSETS_PREFIX ,
15
21
GITBOOK_ICONS_URL : process . env . GITBOOK_ICONS_URL ,
16
22
GITBOOK_ICONS_TOKEN : process . env . GITBOOK_ICONS_TOKEN ,
Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ d1_databases = [
14
14
]
15
15
16
16
[env .staging ]
17
+ routes = [
18
+ { pattern = " open-2c.gitbook-staging.com/*" , zone_name = " gitbook-staging.com" },
19
+ { pattern = " static-2c.gitbook-staging.com/*" , zone_name = " gitbook-staging.com" }
20
+ ]
17
21
kv_namespaces = [
18
22
{ binding = " NEXT_CACHE_WORKERS_KV" , id = " a446e25f12b741afb185f1e5b4474f0a" } # gitbook-open-v2-cache-staging
19
23
]
@@ -22,6 +26,10 @@ d1_databases = [
22
26
]
23
27
24
28
[env .production ]
29
+ routes = [
30
+ { pattern = " open-2c.gitbook.com/*" , zone_name = " gitbook.com" },
31
+ { pattern = " static-2c.gitbook.com/*" , zone_name = " gitbook.com" }
32
+ ]
25
33
kv_namespaces = [
26
34
{ binding = " NEXT_CACHE_WORKERS_KV" , id = " 72379746280d4e79acf24440eea950dc" } # gitbook-open-v2-cache-production
27
35
]
You can’t perform that action at this time.
0 commit comments