@rexezuge/tooling 1.14.0 → 1.16.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.
Files changed (80) hide show
  1. package/README.md +42 -30
  2. package/dist/eslint-rules.d.ts.map +1 -1
  3. package/dist/eslint-rules.js +1 -1
  4. package/dist/eslint-rules.js.map +2 -2
  5. package/dist/eslint-strict.d.ts +2 -1
  6. package/dist/eslint-strict.d.ts.map +1 -1
  7. package/dist/eslint-strict.js +2 -1
  8. package/dist/eslint-strict.js.map +3 -3
  9. package/dist/manifest-validate.d.ts.map +1 -1
  10. package/dist/manifest-validate.js +1 -1
  11. package/dist/manifest-validate.js.map +3 -3
  12. package/dist/manifest.d.ts +21 -0
  13. package/dist/manifest.d.ts.map +1 -1
  14. package/dist/manifest.js.map +2 -2
  15. package/dist/scripts/backup/destinations.d.ts +40 -0
  16. package/dist/scripts/backup/destinations.d.ts.map +1 -0
  17. package/dist/scripts/backup/destinations.js +1 -0
  18. package/dist/scripts/backup/destinations.js.map +7 -0
  19. package/dist/scripts/backup/encrypt-backup.d.ts +5 -2
  20. package/dist/scripts/backup/encrypt-backup.d.ts.map +1 -1
  21. package/dist/scripts/backup/encrypt-backup.js +2 -3
  22. package/dist/scripts/backup/encrypt-backup.js.map +3 -3
  23. package/dist/scripts/backup/naming.d.ts +1 -1
  24. package/dist/scripts/backup/naming.d.ts.map +1 -1
  25. package/dist/scripts/backup/naming.js +1 -1
  26. package/dist/scripts/backup/naming.js.map +3 -3
  27. package/dist/scripts/prepare-wrangler-config.d.ts.map +1 -1
  28. package/dist/scripts/prepare-wrangler-config.js +1 -1
  29. package/dist/scripts/prepare-wrangler-config.js.map +3 -3
  30. package/dist/scripts/wrangler-config/resources.d.ts +11 -2
  31. package/dist/scripts/wrangler-config/resources.d.ts.map +1 -1
  32. package/dist/scripts/wrangler-config/resources.js +1 -1
  33. package/dist/scripts/wrangler-config/resources.js.map +3 -3
  34. package/dist/vitest-aliases.d.ts +7 -1
  35. package/dist/vitest-aliases.d.ts.map +1 -1
  36. package/dist/vitest-aliases.js +1 -1
  37. package/dist/vitest-aliases.js.map +3 -3
  38. package/dist/vitest-integration.d.ts.map +1 -1
  39. package/dist/vitest-integration.js +1 -1
  40. package/dist/vitest-integration.js.map +3 -3
  41. package/dist/vitest-repo.js +1 -1
  42. package/dist/vitest-repo.js.map +3 -3
  43. package/dist/vitest-web.js +1 -1
  44. package/dist/vitest-web.js.map +3 -3
  45. package/dist/vitest.d.ts +1 -1
  46. package/dist/vitest.d.ts.map +1 -1
  47. package/dist/vitest.js +1 -1
  48. package/dist/vitest.js.map +3 -3
  49. package/package.json +3 -3
  50. package/presets/tsconfig/web.json +2 -2
  51. package/schema/manifest.schema.json +28 -1
  52. package/src/eslint-rules.ts +4 -0
  53. package/src/eslint-strict.test.ts +29 -0
  54. package/src/eslint-strict.ts +36 -4
  55. package/src/github/dependabot.yml +14 -4
  56. package/src/github/workflows/backup-d1.yml +15 -0
  57. package/src/github/workflows/backup-main.yml +9 -126
  58. package/src/github/workflows/continuous-deployment.yml +11 -180
  59. package/src/github/workflows/continuous-integration.yml +9 -249
  60. package/src/github/workflows/scheduled-version-update.yml +8 -31
  61. package/src/github/workflows/upstream-sync.yml +8 -49
  62. package/src/manifest-validate.ts +31 -2
  63. package/src/manifest.test.ts +22 -0
  64. package/src/manifest.ts +22 -0
  65. package/src/presets.test.ts +5 -1
  66. package/src/scripts/backup/backup-rules.test.ts +22 -0
  67. package/src/scripts/backup/destinations.ts +59 -0
  68. package/src/scripts/backup/encrypt-backup.ts +58 -48
  69. package/src/scripts/backup/naming.ts +2 -2
  70. package/src/scripts/prepare-wrangler-config.ts +9 -1
  71. package/src/scripts/wrangler-config/resources.test.ts +10 -0
  72. package/src/scripts/wrangler-config/resources.ts +21 -4
  73. package/src/vitest-aliases.test.ts +33 -0
  74. package/src/vitest-aliases.ts +37 -7
  75. package/src/vitest-integration.ts +2 -5
  76. package/src/vitest-repo.ts +2 -2
  77. package/src/vitest-web.ts +2 -2
  78. package/src/vitest.ts +3 -3
  79. package/src/github/actions/retry-step/action.yml +0 -55
  80. package/src/github/actions/setup-env/action.yml +0 -20
@@ -7,7 +7,7 @@ import type tseslint from 'typescript-eslint';
7
7
  *
8
8
  * Every rule here exists because a family repo once re-implemented something the
9
9
  * kit now owns; each message names the kit API to use instead. They use two
10
- * kit-local rules (`rexezuge/restricted-import`, `rexezuge/no-hand-built-envelope`)
10
+ * kit-local rules (`rexezuge/restricted-import`, `rexezuge/no-hand-built-envelope`, `rexezuge/todo-format`)
11
11
  * and `no-restricted-globals` rather than `no-restricted-imports` /
12
12
  * `no-restricted-syntax`: flat config replaces a rule's options per file instead
13
13
  * of merging them, so a strict entry in those two would silently erase the layer
@@ -96,7 +96,39 @@ const noHandBuiltEnvelope: Rule.RuleModule = {
96
96
  },
97
97
  };
98
98
 
99
- export const REXEZUGE_PLUGIN = { rules: { 'restricted-import': restrictedImport, 'no-hand-built-envelope': noHandBuiltEnvelope } };
99
+ /**
100
+ * A task marker is `TODO(<scope>): <text>` (or `FIXME(...)`): who or what it waits on, and what is to be done.
101
+ * A bare `TODO`, `TODO:` or `TODO(sdk)` with no text is a note nobody can act on, so it is an error.
102
+ * Only a marker that starts a comment line is a marker, so prose that mentions the word is left alone.
103
+ * This replaces `sonarjs/todo-tag` and `sonarjs/fixme-tag`, which flagged the scoped form too.
104
+ */
105
+ const TODO_MARKER = /^[\s*/]*(TODO|FIXME)\b(.*)$/;
106
+ const TODO_FORMAT = /^\([^()\s]+\):\s*\S/;
107
+
108
+ const todoFormat: Rule.RuleModule = {
109
+ meta: {
110
+ type: 'suggestion',
111
+ schema: [],
112
+ messages: { bare: '`{{tag}}` needs a scope and a description: `{{tag}}(<scope>): <what is to be done>`.' },
113
+ },
114
+ create(context) {
115
+ return {
116
+ Program() {
117
+ for (const comment of context.sourceCode.getAllComments()) {
118
+ for (const line of comment.value.split('\n')) {
119
+ const match = TODO_MARKER.exec(line);
120
+ if (match === null || TODO_FORMAT.test(match[2] ?? '')) continue;
121
+ context.report({ loc: comment.loc ?? { line: 1, column: 0 }, messageId: 'bare', data: { tag: match[1] ?? 'TODO' } });
122
+ }
123
+ }
124
+ },
125
+ };
126
+ },
127
+ };
128
+
129
+ export const REXEZUGE_PLUGIN = {
130
+ rules: { 'restricted-import': restrictedImport, 'no-hand-built-envelope': noHandBuiltEnvelope, 'todo-format': todoFormat },
131
+ };
100
132
 
101
133
  const TS_FILES = ['**/*.{ts,mts,cts,tsx}'];
102
134
  const SOURCE_FILES = ['**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}'];
@@ -158,9 +190,9 @@ export function strictConfigs(options: StrictOptions): ConfigInput[] {
158
190
  },
159
191
  },
160
192
  {
161
- files: TS_FILES,
193
+ files: SOURCE_FILES,
162
194
  plugins: { rexezuge: REXEZUGE_PLUGIN },
163
- rules: {},
195
+ rules: { 'rexezuge/todo-format': 'error' },
164
196
  },
165
197
  // Rules of one name replace each other per file, so each region states its
166
198
  // whole ban list: framework + kit outside the http layer and apps/api (the
@@ -1,7 +1,13 @@
1
- # Dependabot — weekly dependency updates, grouped so one PR covers the
2
- # toolchain rather than twelve separate ones. @rexezuge/* updates land in
3
- # their own group, which is the kit's upgrade path: a bump PR per repo, and
4
- # the repo's own CI is the gate.
1
+ # Dependabot: weekly dependency updates, grouped so one PR covers a concern instead of a dozen.
2
+ #
3
+ # The npm ecosystem at `/` reads the pnpm workspace's `catalog:` in pnpm-workspace.yaml, so a bump edits the
4
+ # catalog entry once instead of every package.json that uses it. Groups:
5
+ # kit @rexezuge/*, the family SDK.
6
+ # toolchain the compiler, test runner, bundler, linters and wrangler.
7
+ # cloudflare @cloudflare/*.
8
+ # worker-ci.yml auto-merges a PR of these three groups once CI is green, and only when every update in it is a patch
9
+ # or a minor (never a major). It reads the group from Dependabot itself (dependabot/fetch-metadata's `dependency-group`),
10
+ # so renaming a group here changes what is auto-merged: keep the names.
5
11
 
6
12
  version: 2
7
13
  updates:
@@ -20,8 +26,12 @@ updates:
20
26
  patterns:
21
27
  - 'typescript'
22
28
  - 'vitest'
29
+ - '@vitest/*'
23
30
  - 'vite'
31
+ - '@vitejs/*'
24
32
  - 'eslint'
33
+ - 'eslint-*'
34
+ - '@eslint/*'
25
35
  - 'typescript-eslint'
26
36
  - 'prettier'
27
37
  - 'wrangler'
@@ -0,0 +1,15 @@
1
+ # A thin caller: the pipeline lives in Rexezuge-CloudflareWorkers/SDK/.github/workflows/backup-d1.yml (tag v1).
2
+ # Jobs switch on .rexezuge.jsonc features; change behaviour there or in the SDK, not here.
3
+ name: Backup D1
4
+
5
+ on:
6
+ schedule:
7
+ - cron: '15 4 * * *'
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ backup-d1:
12
+ permissions:
13
+ contents: read
14
+ uses: Rexezuge-CloudflareWorkers/SDK/.github/workflows/backup-d1.yml@v1
15
+ secrets: inherit
@@ -1,133 +1,16 @@
1
- # Backup Main Branch — mirror the repository to secondary git forges.
2
- #
3
- # Converged from the family's backup-main.yml. Destinations are opt-in by
4
- # secret: with neither BACKUP_REPO_AZURE_DEVOPS_SSH_KEY nor
5
- # BACKUP_REPO_GITLAB_* configured, the check job reports both false and every
6
- # downstream job is skipped. Push to main seeds the mirror; the monthly
7
- # schedule re-verifies it.
8
- #
9
- # No REPLACE_ME placeholders: every repo-specific value is a secret, so this
10
- # file copies verbatim. It needs .github/actions/retry-step alongside it.
11
-
12
- name: Backup Main Branch
13
-
14
- permissions:
15
- contents: read
1
+ # A thin caller: the pipeline lives in Rexezuge-CloudflareWorkers/SDK/.github/workflows/backup-main.yml (tag v1).
2
+ # Jobs switch on .rexezuge.jsonc features; change behaviour there or in the SDK, not here.
3
+ name: Backup Main
16
4
 
17
5
  on:
18
6
  push:
19
- branches:
20
- - main
7
+ branches: [main]
21
8
  schedule:
22
9
  - cron: '0 0 5 * *'
23
10
 
24
11
  jobs:
25
- check-secrets:
26
- name: Check Secrets
27
- runs-on: ubuntu-latest
28
- outputs:
29
- azure-configured: ${{ steps.check.outputs.azure }}
30
- gitlab-configured: ${{ steps.check.outputs.gitlab }}
31
- steps:
32
- - name: Detect Configured Destinations
33
- id: check
34
- env:
35
- AZURE_KEY: ${{ secrets.BACKUP_REPO_AZURE_DEVOPS_SSH_KEY }}
36
- AZURE_URL: ${{ secrets.BACKUP_REPO_AZURE_DEVOPS_REPO_URL }}
37
- GITLAB_KEY: ${{ secrets.BACKUP_REPO_GITLAB_SSH_KEY }}
38
- GITLAB_URL: ${{ secrets.BACKUP_REPO_GITLAB_REPO_URL }}
39
- run: |
40
- if [ -n "$AZURE_KEY" ] && [ -n "$AZURE_URL" ]; then
41
- echo "azure=true" >> "$GITHUB_OUTPUT"
42
- else
43
- echo "azure=false" >> "$GITHUB_OUTPUT"
44
- fi
45
- if [ -n "$GITLAB_KEY" ] && [ -n "$GITLAB_URL" ]; then
46
- echo "gitlab=true" >> "$GITHUB_OUTPUT"
47
- else
48
- echo "gitlab=false" >> "$GITHUB_OUTPUT"
49
- fi
50
-
51
- backup-azure-devops:
52
- needs: check-secrets
53
- if: >-
54
- ${{ !github.event.repository.fork &&
55
- needs.check-secrets.outputs.azure-configured == 'true' }}
56
- name: Azure DevOps
57
- runs-on: ubuntu-latest
58
-
59
- steps:
60
- - name: Checkout Source Repository
61
- uses: actions/checkout@v6
62
- with:
63
- fetch-depth: 0
64
-
65
- - name: Configure Git
66
- run: |
67
- git config user.name "Actions"
68
- git config user.email "actions@github.com"
69
-
70
- # The key reaches the shell through env, never through `${{ }}` inside the
71
- # script, and is written by printf (no echo escape interpretation) into a
72
- # file created 0600 from the start. accept-new pins the forge's host key on
73
- # first contact and refuses a changed one, unlike `no`.
74
- - name: Set Up SSH for Azure DevOps
75
- env:
76
- SSH_KEY: ${{ secrets.BACKUP_REPO_AZURE_DEVOPS_SSH_KEY }}
77
- run: |
78
- install -d -m 700 ~/.ssh
79
- install -m 600 /dev/null ~/.ssh/id_rsa
80
- printf '%s\n' "$SSH_KEY" > ~/.ssh/id_rsa
81
- printf 'Host *\n\tStrictHostKeyChecking accept-new\n\tIdentityFile ~/.ssh/id_rsa\n' > ~/.ssh/config
82
- chmod 600 ~/.ssh/config
83
-
84
- - name: Add SSH Remote
85
- env:
86
- REPO_URL: ${{ secrets.BACKUP_REPO_AZURE_DEVOPS_REPO_URL }}
87
- run: git remote add backup "$REPO_URL"
88
-
89
- - name: Push main Branch to Azure DevOps
90
- uses: ./.github/actions/retry-step
91
- with:
92
- command: git push --force backup main:main
93
- max_attempts: '3'
94
-
95
- backup-gitlab:
96
- needs: check-secrets
97
- if: >-
98
- ${{ !github.event.repository.fork &&
99
- needs.check-secrets.outputs.gitlab-configured == 'true' }}
100
- name: GitLab
101
- runs-on: ubuntu-latest
102
-
103
- steps:
104
- - name: Checkout Source Repository
105
- uses: actions/checkout@v6
106
- with:
107
- fetch-depth: 0
108
-
109
- - name: Configure Git
110
- run: |
111
- git config user.name "Actions"
112
- git config user.email "actions@github.com"
113
-
114
- - name: Set Up SSH for GitLab
115
- env:
116
- SSH_KEY: ${{ secrets.BACKUP_REPO_GITLAB_SSH_KEY }}
117
- run: |
118
- install -d -m 700 ~/.ssh
119
- install -m 600 /dev/null ~/.ssh/id_rsa
120
- printf '%s\n' "$SSH_KEY" > ~/.ssh/id_rsa
121
- printf 'Host *\n\tStrictHostKeyChecking accept-new\n\tIdentityFile ~/.ssh/id_rsa\n' > ~/.ssh/config
122
- chmod 600 ~/.ssh/config
123
-
124
- - name: Add SSH Remote
125
- env:
126
- REPO_URL: ${{ secrets.BACKUP_REPO_GITLAB_REPO_URL }}
127
- run: git remote add backup "$REPO_URL"
128
-
129
- - name: Push main Branch to GitLab
130
- uses: ./.github/actions/retry-step
131
- with:
132
- command: git push --force backup main:main
133
- max_attempts: '3'
12
+ backup-main:
13
+ permissions:
14
+ contents: read
15
+ uses: Rexezuge-CloudflareWorkers/SDK/.github/workflows/backup-main.yml@v1
16
+ secrets: inherit
@@ -1,188 +1,19 @@
1
- # Continuous Deployment — deploy the worker after CI passes on main.
2
- #
3
- # Converged from the eight repos that deploy (Records-Provider and CalDAV-Bridge
4
- # deploy differently and are left out of this merge). The shape: a `workflow_run`
5
- # trigger so the deploy runs against the SHA CI actually approved, then the
6
- # wrangler config materialized from the template — no committed secrets — then the
7
- # secrets provisioned, then the database migrated, then a dry run as a gate, then
8
- # the deploy.
9
- #
10
- # PLACEHOLDERS:
11
- # * REPLACE_ME_SCOPE the npm scope, in `pnpm --filter @REPLACE_ME_SCOPE/web build`.
12
- # * REPLACE_ME_D1_BINDING the D1 binding `wrangler d1 migrations apply` targets.
13
- # * REPLACE_ME_PAGES the Cloudflare Pages project name, for repos with a SPA.
14
- #
15
- # The two workspace variables the config step reads (`WRANGLER_JSONC`,
16
- # `WRANGLER_PATCH_JSON`, `WRANGLER_VARS_PATCH_JSON`) are how a repo with several
17
- # environments supplies per-environment settings without a second template file.
18
-
1
+ # A thin caller: the pipeline lives in Rexezuge-CloudflareWorkers/SDK/.github/workflows/worker-cd.yml (tag v1).
2
+ # Jobs switch on .rexezuge.jsonc features; change behaviour there or in the SDK, not here.
19
3
  name: Continuous Deployment
20
4
 
21
- permissions:
22
- contents: read
23
-
24
5
  on:
25
6
  workflow_run:
26
- workflows:
27
- - Continuous Integration
28
- branches:
29
- - main
30
- types:
31
- - completed
7
+ workflows: ['Continuous Integration']
8
+ types: [completed]
9
+ branches: [main]
32
10
  repository_dispatch:
33
- types:
34
- - Upstream Sync Deployment
11
+ types: [upstream-sync]
35
12
  workflow_dispatch:
36
13
 
37
- concurrency:
38
- group: continuous-deployment-${{ github.event.workflow_run.head_branch || github.event.client_payload.branch || github.ref }}
39
- cancel-in-progress: false
40
-
41
14
  jobs:
42
- deploy-worker:
43
- if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }}
44
- name: Deploy Cloudflare Worker
45
- runs-on: ubuntu-latest
46
-
47
- steps:
48
- - name: Checkout Repository
49
- uses: actions/checkout@v6
50
- with:
51
- # The SHA CI approved, not the tip of main: a push that lands while the
52
- # workflow_run is in flight must not be what gets deployed.
53
- ref: ${{ github.event.workflow_run.head_sha || github.event.client_payload.sha || github.sha }}
54
-
55
- - name: Setup Environment
56
- uses: ./.github/actions/setup-env
57
-
58
- - name: Prepare Wrangler Configuration
59
- uses: ./.github/actions/retry-step
60
- with:
61
- command: pnpm exec tsx scripts/prepare-wrangler-config.ts
62
- max_attempts: '3'
63
- env:
64
- WRANGLER_JSONC: ${{ vars.WRANGLER_JSONC }}
65
- WRANGLER_PATCH_JSON: ${{ vars.WRANGLER_PATCH_JSON }}
66
- WRANGLER_VARS_PATCH_JSON: ${{ vars.WRANGLER_VARS_PATCH_JSON }}
67
- CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
68
- CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
69
-
70
- # A `secrets_store_secrets` binding fails the deploy unless the named secret
71
- # already exists. Nothing creates it — Cloudflare will not generate a value —
72
- # so this is the only thing standing between a fresh account and a deploy that
73
- # cannot succeed. Create-if-absent: an existing value still seals every stored
74
- # credential and is never replaced by a redeploy.
75
- - name: Initialize Cloudflare Secrets
76
- uses: ./.github/actions/retry-step
77
- with:
78
- command: pnpm exec tsx scripts/init-secrets.ts
79
- max_attempts: '3'
80
- env:
81
- CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
82
- CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
83
-
84
- # PLACEHOLDER: the D1 binding to migrate.
85
- - name: Apply Database Migration
86
- uses: ./.github/actions/retry-step
87
- with:
88
- command: pnpm exec wrangler d1 migrations apply REPLACE_ME_D1_BINDING --remote
89
- max_attempts: '3'
90
- env:
91
- CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
92
- CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
93
-
94
- # PLACEHOLDER: the workspace filter for the SPA. The API worker serves the
95
- # shell this build embeds, so the build is a precondition of the deploy, not
96
- # a convenience.
97
- - name: Build Web App
98
- run: pnpm --filter @REPLACE_ME_SCOPE/web build
99
-
100
- # A gate, not a rehearsal. Separate from the deploy below and deliberately
101
- # **not** retried: a dry run that fails is a real defect — a bundle over the
102
- # size limit, a binding the template no longer declares — and retrying it
103
- # three times only delays the report while making the log harder to read.
104
- - name: Dry Run Deploy with Wrangler
105
- run: pnpm exec wrangler deploy --dry-run
106
- env:
107
- CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
108
- CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
109
-
110
- - name: Deploy with Wrangler
111
- uses: ./.github/actions/retry-step
112
- with:
113
- command: pnpm exec wrangler deploy
114
- max_attempts: '3'
115
- env:
116
- CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
117
- CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
118
-
119
- # Repos with a Pages front end keep this job; it is the reason
120
- # `functions/[[path]].ts` exists — Pages serves `dist/` as static files, and
121
- # `/user/...` would resolve to a 404 without the catch-all proxy to the worker.
122
- deploy-pages:
123
- if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }}
124
- name: Deploy Cloudflare Pages
125
- runs-on: ubuntu-latest
126
-
127
- steps:
128
- - name: Checkout Repository
129
- uses: actions/checkout@v6
130
- with:
131
- ref: ${{ github.event.workflow_run.head_sha || github.event.client_payload.sha || github.sha }}
132
-
133
- - name: Setup Environment
134
- uses: ./.github/actions/setup-env
135
-
136
- # PLACEHOLDER: the workspace filter for the SPA.
137
- - name: Build Frontend
138
- run: pnpm --filter @REPLACE_ME_SCOPE/web build
139
-
140
- - name: Configure Pages Service Bindings
141
- run: cp apps/web/wrangler.template.jsonc wrangler.jsonc
142
-
143
- # PLACEHOLDER: the Pages project name. Created if absent, and then polled
144
- # until it is visible, because a project that exists but is not yet listed
145
- # makes the deploy below fail with an error that names the deploy rather
146
- # than the propagation delay.
147
- - name: Ensure Pages Project Exists
148
- env:
149
- CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
150
- CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
151
- PROJECT: ${{ vars.CLOUDFLARE_PAGES_PROJECT_NAME || 'REPLACE_ME_PAGES' }}
152
- DEPLOY_BRANCH: ${{ github.event.workflow_run.head_branch || github.event.client_payload.branch || github.ref_name }}
153
- run: |
154
- if CREATE_OUTPUT="$(pnpm exec wrangler pages project create "${PROJECT}" --production-branch "${DEPLOY_BRANCH}" 2>&1)"; then
155
- echo "Created Pages project \"${PROJECT}\"."
156
- elif echo "${CREATE_OUTPUT}" | grep -qi "already exists"; then
157
- echo "Pages project \"${PROJECT}\" already exists."
158
- else
159
- echo "${CREATE_OUTPUT}"
160
- echo "Failed to create Pages project \"${PROJECT}\"." >&2
161
- exit 1
162
- fi
163
- for _ in $(seq 1 18); do
164
- if pnpm exec wrangler pages project list 2>/dev/null | grep -qE "(^|[[:space:]])${PROJECT}([[:space:]]|$)"; then
165
- echo "Pages project \"${PROJECT}\" is ready."
166
- exit 0
167
- fi
168
- sleep 5
169
- done
170
- echo "Pages project \"${PROJECT}\" is still not visible after polling." >&2
171
- exit 1
172
-
173
- - name: Deploy with Wrangler Pages
174
- uses: ./.github/actions/retry-step
175
- with:
176
- command: >
177
- pnpm exec wrangler pages deploy apps/web/dist
178
- --project-name "${PROJECT}"
179
- --branch "${DEPLOY_BRANCH}"
180
- --commit-hash "${DEPLOY_SHA}"
181
- --commit-message "$(git log -1 --pretty=%s)"
182
- max_attempts: '3'
183
- env:
184
- CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
185
- CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
186
- PROJECT: ${{ vars.CLOUDFLARE_PAGES_PROJECT_NAME || 'REPLACE_ME_PAGES' }}
187
- DEPLOY_BRANCH: ${{ github.event.workflow_run.head_branch || github.event.client_payload.branch || github.ref_name }}
188
- DEPLOY_SHA: ${{ github.event.workflow_run.head_sha || github.event.client_payload.sha || github.sha }}
15
+ worker-cd:
16
+ permissions:
17
+ contents: read
18
+ uses: Rexezuge-CloudflareWorkers/SDK/.github/workflows/worker-cd.yml@v1
19
+ secrets: inherit