mandrel-platform 0.17.2 → 0.19.0
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/README.md +254 -34
- package/config/commitlint.base.mjs +36 -0
- package/config/edge-security/rate-limit.mjs +103 -20
- package/config/repo-settings.schema.json +78 -0
- package/default.json +4 -19
- package/package.json +2 -1
- package/scripts/apply-uptime-monitors.mjs +378 -0
- package/scripts/apply-uptime-monitors.test.mjs +372 -0
- package/scripts/audit-check.mjs +321 -180
- package/scripts/audit-check.test.mjs +263 -0
- package/scripts/check-action-pins.mjs +106 -173
- package/scripts/check-coverage-threshold.mjs +44 -6
- package/scripts/check-coverage-threshold.test.mjs +43 -0
- package/scripts/check-docs-staleness.mjs +130 -81
- package/scripts/check-docs-staleness.test.mjs +130 -0
- package/scripts/check-pin-drift.mjs +61 -110
- package/scripts/check-pin-drift.test.mjs +175 -3
- package/scripts/check-repo-settings.mjs +363 -0
- package/scripts/check-repo-settings.test.mjs +320 -0
- package/scripts/check-required-contexts.mjs +247 -129
- package/scripts/check-required-contexts.test.mjs +137 -0
- package/scripts/check-ruleset.mjs +435 -0
- package/scripts/check-ruleset.test.mjs +439 -0
- package/scripts/check-workflow-portability.mjs +163 -118
- package/scripts/check-workflow-portability.test.mjs +199 -0
- package/scripts/check-wrangler-baseline.mjs +514 -0
- package/scripts/check-wrangler-baseline.test.mjs +454 -0
- package/scripts/edge-security.test.mjs +81 -1
- package/scripts/lib/args.mjs +93 -0
- package/scripts/lib/args.test.mjs +152 -0
- package/scripts/lib/gh-json.mjs +119 -0
- package/scripts/lib/semver-duration.mjs +84 -0
- package/scripts/lib/uses-pins.mjs +220 -0
- package/scripts/lib/uses-pins.test.mjs +219 -0
- package/scripts/lib/walk.mjs +74 -0
- package/scripts/platform-repair.mjs +9 -3
- package/scripts/platform-sync.mjs +533 -5
- package/scripts/platform-sync.test.mjs +477 -0
- package/scripts/update-semgrep-rules.mjs +76 -5
- package/templates/runbooks/README.md +9 -5
- package/templates/runbooks/branch-protection-setup.md +9 -3
- package/templates/workflows/deploy-staging.yml +86 -0
- package/templates/workflows/uptime-apply.yml +54 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
name: deploy-staging
|
|
2
|
+
|
|
3
|
+
# Canonical staging-deploy caller template (Story #175).
|
|
4
|
+
#
|
|
5
|
+
# > **Thin local caller.** The defence-in-depth deploy core (secret-isolation
|
|
6
|
+
# > audit -> CF env gate -> pre-migration snapshot -> migrate -> deploy ->
|
|
7
|
+
# > boot-smoke + auto-rollback) AND the CI-green guard both live in the shared
|
|
8
|
+
# > `dsj1984/mandrel-platform` `deploy-cloudflare.yml` reusable workflow — see
|
|
9
|
+
# > https://github.com/dsj1984/mandrel-platform/blob/main/docs/reusable-workflows.md#deploy-cloudflareyml.
|
|
10
|
+
# > This file only holds <PROJECT_NAME>-specific values (worker names, build
|
|
11
|
+
# > step, secret mapping). When the deploy PROCESS changes, that change lands
|
|
12
|
+
# > upstream in mandrel-platform — not here.
|
|
13
|
+
#
|
|
14
|
+
# One paved road (operator decision 2026-07-01, D4): every consumer triggers
|
|
15
|
+
# staging deploy via `workflow_run` on its own CI workflow, gated on
|
|
16
|
+
# `conclusion == 'success'`. `workflow_run` fires on BOTH a successful AND a
|
|
17
|
+
# failed upstream run, so a caller-side guard against a red run used to be
|
|
18
|
+
# REQUIRED here — every consumer hand-copied the same `preflight` job (see
|
|
19
|
+
# mandrel-platform Story #175 context). That guard is now a `require-ci-green`
|
|
20
|
+
# job INSIDE `deploy-cloudflare.yml` itself (`github.event` inside a reusable
|
|
21
|
+
# workflow is the CALLER's event, so the shared workflow can see and gate on
|
|
22
|
+
# the `workflow_run` conclusion even though it cannot own this file's `on:`
|
|
23
|
+
# block). This template needs NO caller-side preflight guard as a result —
|
|
24
|
+
# copy it as-is and fill in the placeholders below.
|
|
25
|
+
#
|
|
26
|
+
# Replace every <PLACEHOLDER> with your project's real values:
|
|
27
|
+
# <CI_WORKFLOW_NAME> the `name:` of the workflow this deploy should
|
|
28
|
+
# gate on (e.g. "quality", "CI", "PR Quality").
|
|
29
|
+
# Must match EXACTLY — GitHub matches
|
|
30
|
+
# `workflow_run.workflows` by workflow name, not
|
|
31
|
+
# file path.
|
|
32
|
+
# <MANDREL_PLATFORM_SHA> the pinned mandrel-platform commit SHA (resolve
|
|
33
|
+
# via `node scripts/platform-sync.mjs --ref
|
|
34
|
+
# <release-tag>` from the consumer repo root, or
|
|
35
|
+
# hand-resolve via `git ls-remote`).
|
|
36
|
+
# <MANDREL_PLATFORM_TAG> the human-readable release tag matching the SHA
|
|
37
|
+
# above (trailing `# <tag>` comment).
|
|
38
|
+
# <WORKERS_CSV> comma-separated Worker names for this env, e.g.
|
|
39
|
+
# "api,web".
|
|
40
|
+
# <BUILD_COMMAND> optional build command (omit build-command /
|
|
41
|
+
# build-artifact entirely if the deploy job's
|
|
42
|
+
# default checkout is build-ready).
|
|
43
|
+
#
|
|
44
|
+
# See the full input/secret contract:
|
|
45
|
+
# https://github.com/dsj1984/mandrel-platform/blob/main/docs/reusable-workflows.md#deploy-cloudflareyml
|
|
46
|
+
|
|
47
|
+
on:
|
|
48
|
+
# CI-green gate: fires when <CI_WORKFLOW_NAME> finishes on main. The shared
|
|
49
|
+
# deploy-cloudflare.yml's require-ci-green job skips-with-notice unless the
|
|
50
|
+
# upstream conclusion was 'success' — no caller-side guard needed.
|
|
51
|
+
workflow_run:
|
|
52
|
+
workflows: [<CI_WORKFLOW_NAME>]
|
|
53
|
+
branches: [main]
|
|
54
|
+
types: [completed]
|
|
55
|
+
# Manual on-demand trigger (UI "Run workflow" + `gh workflow run`).
|
|
56
|
+
# workflow_dispatch always passes the shared workflow's CI-green guard
|
|
57
|
+
# (operator-intentional, no upstream conclusion to gate on).
|
|
58
|
+
workflow_dispatch:
|
|
59
|
+
|
|
60
|
+
permissions:
|
|
61
|
+
contents: read
|
|
62
|
+
|
|
63
|
+
# Cancel an in-flight staging deploy when a newer commit lands on main — only
|
|
64
|
+
# the freshest tip of main should reach the staging surfaces. The shared
|
|
65
|
+
# deploy-cloudflare.yml additionally serializes per-environment.
|
|
66
|
+
concurrency:
|
|
67
|
+
group: deploy-staging
|
|
68
|
+
cancel-in-progress: true
|
|
69
|
+
|
|
70
|
+
jobs:
|
|
71
|
+
deploy:
|
|
72
|
+
name: Staging deploy (shared deploy-cloudflare.yml)
|
|
73
|
+
uses: dsj1984/mandrel-platform/.github/workflows/deploy-cloudflare.yml@<MANDREL_PLATFORM_SHA> # <MANDREL_PLATFORM_TAG>
|
|
74
|
+
with:
|
|
75
|
+
environment: staging
|
|
76
|
+
gh-environment: staging
|
|
77
|
+
workers: <WORKERS_CSV>
|
|
78
|
+
migrate: true
|
|
79
|
+
# db-engine defaults to 'd1'. Set db-engine + migrate-command +
|
|
80
|
+
# snapshot-command for a non-D1 engine (e.g. Turso) — see the contract
|
|
81
|
+
# doc's "command seams" section.
|
|
82
|
+
# Frozen secret allowlist: only {CLOUDFLARE_*, TURSO_*} cross into the
|
|
83
|
+
# shared workflow. Map your project's secret NAMES onto these slots.
|
|
84
|
+
secrets:
|
|
85
|
+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
86
|
+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: uptime-apply
|
|
2
|
+
|
|
3
|
+
# Canonical staging-deploy caller template (Story #180).
|
|
4
|
+
#
|
|
5
|
+
# > **Thin local caller.** The Better Stack monitor schema + apply logic
|
|
6
|
+
# > (config validation, live-diff, create/update, graceful skip-with-notice
|
|
7
|
+
# > when the secret isn't provisioned) lives in the shared
|
|
8
|
+
# > `dsj1984/mandrel-platform` `uptime-apply.yml` reusable workflow — see
|
|
9
|
+
# > https://github.com/dsj1984/mandrel-platform/blob/main/docs/reusable-workflows.md#uptime-applyyml.
|
|
10
|
+
# > This file only holds <PROJECT_NAME>-specific values (the monitor-config
|
|
11
|
+
# > path and the apply trigger). When the apply PROCESS changes, that change
|
|
12
|
+
# > lands upstream in mandrel-platform — not here.
|
|
13
|
+
#
|
|
14
|
+
# Replace every <PLACEHOLDER> with your project's real values:
|
|
15
|
+
# <MANDREL_PLATFORM_SHA> the pinned mandrel-platform commit SHA (resolve
|
|
16
|
+
# via `node scripts/platform-sync.mjs --ref
|
|
17
|
+
# <release-tag>` from the consumer repo root, or
|
|
18
|
+
# hand-resolve via `git ls-remote`).
|
|
19
|
+
# <MANDREL_PLATFORM_TAG> the human-readable release tag matching the SHA
|
|
20
|
+
# above (trailing `# <tag>` comment).
|
|
21
|
+
# <MONITOR_CONFIG_PATH> path to this repo's monitor-config JSON, e.g.
|
|
22
|
+
# "infra/uptime/monitors.json".
|
|
23
|
+
#
|
|
24
|
+
# See the full input/secret contract:
|
|
25
|
+
# https://github.com/dsj1984/mandrel-platform/blob/main/docs/reusable-workflows.md#uptime-applyyml
|
|
26
|
+
|
|
27
|
+
on:
|
|
28
|
+
push:
|
|
29
|
+
branches: [main]
|
|
30
|
+
workflow_dispatch:
|
|
31
|
+
|
|
32
|
+
permissions:
|
|
33
|
+
contents: read
|
|
34
|
+
|
|
35
|
+
concurrency:
|
|
36
|
+
group: uptime-apply
|
|
37
|
+
cancel-in-progress: false
|
|
38
|
+
|
|
39
|
+
jobs:
|
|
40
|
+
uptime:
|
|
41
|
+
name: Uptime apply (shared uptime-apply.yml)
|
|
42
|
+
uses: dsj1984/mandrel-platform/.github/workflows/uptime-apply.yml@<MANDREL_PLATFORM_SHA> # <MANDREL_PLATFORM_TAG>
|
|
43
|
+
with:
|
|
44
|
+
monitor-config: <MONITOR_CONFIG_PATH>
|
|
45
|
+
# apply:'true' on push to main converges live Better Stack monitors to
|
|
46
|
+
# the checked-in config; a workflow_dispatch preview run can pass
|
|
47
|
+
# apply:'false' instead to dry-run without writing.
|
|
48
|
+
apply: ${{ github.event_name == 'push' && 'true' || 'false' }}
|
|
49
|
+
# Frozen secret surface: only these two cross into the shared workflow.
|
|
50
|
+
# Both are optional on the shared side — an absent BETTERSTACK_API_TOKEN
|
|
51
|
+
# is the documented graceful-degradation (skip-with-notice) path.
|
|
52
|
+
secrets:
|
|
53
|
+
BETTERSTACK_API_TOKEN: ${{ secrets.BETTERSTACK_API_TOKEN }}
|
|
54
|
+
UPTIME_ALERT_EMAIL: ${{ secrets.UPTIME_ALERT_EMAIL }}
|