@norskvideo/ctl-dev-kit 0.2.94 → 0.2.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/conventions/docs-site.md
CHANGED
|
@@ -231,10 +231,11 @@ What the repo needs, per site, and none of it to build or review one locally:
|
|
|
231
231
|
|
|
232
232
|
1. **A Cloudflare Pages project**, e.g. `norsk-acme-docs`.
|
|
233
233
|
2. **A custom domain** on it — `<product>.norsk.video` — and the DNS record.
|
|
234
|
-
3. **
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
`CLOUDFLARE_ACCOUNT_ID`.
|
|
234
|
+
3. **The Cloudflare credentials reaching the repo.** The secret
|
|
235
|
+
`CLOUDFLARE_API_TOKEN`, a Pages:Edit token that covers the new project
|
|
236
|
+
(Pages permissions are account-wide), and the variable
|
|
237
|
+
`CLOUDFLARE_ACCOUNT_ID`. Both are org-level, shared with selected
|
|
238
|
+
repositories: add the repo to each. The workflow verifies the token at the API (both the
|
|
238
239
|
user-owned and the account-owned endpoint), never with `wrangler whoami`,
|
|
239
240
|
which a Pages:Edit token cannot answer.
|
|
240
241
|
4. **One repo variable.** `NORSK_DOCS_SITE_PROJECT`, the project name from
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
# site publishes the day the variable is
|
|
27
27
|
# set, with no change here.
|
|
28
28
|
# secret CLOUDFLARE_API_TOKEN a Pages:Edit token covering that project
|
|
29
|
-
#
|
|
29
|
+
# variable CLOUDFLARE_ACCOUNT_ID the account the project lives in: not a
|
|
30
|
+
# secret, and the org already shares it as
|
|
31
|
+
# a variable (norsk-ctl reads it the same way)
|
|
30
32
|
#
|
|
31
33
|
# The site is BUILT whether or not it will be deployed: if the build is only
|
|
32
34
|
# exercised on the day the Pages project appears, that day is when we find out
|
|
@@ -209,7 +211,7 @@ jobs:
|
|
|
209
211
|
- name: Deploy to Cloudflare Pages
|
|
210
212
|
env:
|
|
211
213
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
212
|
-
CLOUDFLARE_ACCOUNT_ID: ${{
|
|
214
|
+
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
|
|
213
215
|
NORSK_DOCS_SITE_PROJECT: ${{ vars.NORSK_DOCS_SITE_PROJECT }}
|
|
214
216
|
PAGES_BRANCH: ${{ github.ref_name }}
|
|
215
217
|
run: |
|
|
@@ -222,13 +224,13 @@ jobs:
|
|
|
222
224
|
echo " 1. Create a Cloudflare Pages project for this site (e.g. $(basename "$GITHUB_REPOSITORY")-docs)."
|
|
223
225
|
echo " 2. Add its custom domain${origin:+ (${origin#https://})} and the DNS record."
|
|
224
226
|
echo " 3. Make sure CLOUDFLARE_API_TOKEN (Pages:Edit) covers that project, and that"
|
|
225
|
-
echo "
|
|
227
|
+
echo " the variable CLOUDFLARE_ACCOUNT_ID reaches this repo."
|
|
226
228
|
echo " 4. Set the repo variable NORSK_DOCS_SITE_PROJECT to the project name."
|
|
227
229
|
echo " Nothing in this workflow changes. See @norskvideo/ctl-dev-kit conventions/docs-site.md, Publishing."
|
|
228
230
|
exit 0
|
|
229
231
|
fi
|
|
230
232
|
if [ -z "${CLOUDFLARE_API_TOKEN:-}" ] || [ -z "${CLOUDFLARE_ACCOUNT_ID:-}" ]; then
|
|
231
|
-
echo "::error::NORSK_DOCS_SITE_PROJECT=$NORSK_DOCS_SITE_PROJECT is set, but
|
|
233
|
+
echo "::error::NORSK_DOCS_SITE_PROJECT=$NORSK_DOCS_SITE_PROJECT is set, but this repo needs both the secret CLOUDFLARE_API_TOKEN and the variable CLOUDFLARE_ACCOUNT_ID"
|
|
232
234
|
exit 1
|
|
233
235
|
fi
|
|
234
236
|
cf_verify() {
|