@rexezuge/tooling 1.9.4 → 1.11.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 CHANGED
@@ -307,12 +307,13 @@ Known limit, stated in the module: a _stale but self-consistent_ pair passes.
307
307
 
308
308
  ### The backup helpers
309
309
 
310
- `backup/{d1-target,destination-config,naming,retention,encrypt-backup}.ts` are the
310
+ `backup/{d1-target,destination-config,naming,encrypt-backup}.ts` are the
311
311
  generic half of Edge-Sonic's backup suite — the rules, not the upload jobs.
312
312
  `d1-target.ts` refuses to export a database that was auto-provisioned moments ago,
313
313
  `destination-config.ts` fails closed on an unencrypted destination, `naming.ts`
314
314
  pins the artifact format (the workflow's upload glob and this prefix are one fact in
315
- two places), `retention.ts` rejects a bad window rather than defaulting one, and
315
+ two places) and owns the retention window — `requireRetentionDays` rejects a bad
316
+ `BACKUP_RETENTION_DAYS` rather than defaulting one — and
316
317
  `encrypt-backup.ts` does the crypto in-process with the kit's own AES-GCM.
317
318
 
318
319
  **Left local, deliberately:** `s3-prune.ts`, `upload-s3.ts`, `upload-webdav.ts`,
@@ -333,6 +334,7 @@ src/github/
333
334
  workflows/continuous-deployment.yml # workflow_run-gated deploy, worker + pages
334
335
  workflows/scheduled-version-update.yml # .github/.version bump
335
336
  workflows/backup-main.yml # secret-gated mirrors to Azure DevOps / GitLab
337
+ workflows/upstream-sync.yml # a fork's weekly pull from its upstream, then CI dispatch
336
338
  actions/setup-env/action.yml # pnpm + node store cache
337
339
  actions/retry-step/action.yml # retry a bash command, annotate the attempts
338
340
  dependabot.yml # weekly, with the @rexezuge/* group
@@ -341,7 +343,8 @@ src/github/
341
343
  Copy the tree to the repo root. Placeholders are marked `REPLACE` and listed at the
342
344
  top of each file; the one that must change for the workflows to run at all is the
343
345
  `pnpm --filter @<scope>/web build` invocation in `continuous-integration.yml` and
344
- `continuous-deployment.yml`.
346
+ `continuous-deployment.yml`. `upstream-sync.yml` needs its `REPLACE_ME_ORG/REPLACE_ME_REPO`
347
+ upstream; `backup-main.yml` has no placeholders (every value is a secret).
345
348
 
346
349
  ---
347
350
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rexezuge/tooling",
3
- "version": "1.9.4",
3
+ "version": "1.11.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,7 +38,7 @@
38
38
  "src"
39
39
  ],
40
40
  "dependencies": {
41
- "@rexezuge/d1": "1.9.4"
41
+ "@rexezuge/d1": "1.11.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "eslint": "^10.0.0",
@@ -74,6 +74,7 @@
74
74
  "scripts": {
75
75
  "build": "tsc -p tsconfig.json && node ../../scripts/minify-dist.mjs",
76
76
  "typecheck": "tsc -p tsconfig.test.json --noEmit",
77
- "test": "vitest run"
77
+ "test": "vitest run",
78
+ "test:coverage": "vitest run --coverage"
78
79
  }
79
80
  }
@@ -5,6 +5,9 @@
5
5
  # BACKUP_REPO_GITLAB_* configured, the check job reports both false and every
6
6
  # downstream job is skipped. Push to main seeds the mirror; the monthly
7
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.
8
11
 
9
12
  name: Backup Main Branch
10
13
 
@@ -44,3 +47,87 @@ jobs:
44
47
  else
45
48
  echo "gitlab=false" >> "$GITHUB_OUTPUT"
46
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'