@decocms/start 2.30.1 → 4.0.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/.agents/skills/deco-to-tanstack-migration/SKILL.md +1 -1
- package/.agents/skills/deco-to-tanstack-migration/references/worker-cloudflare.md +31 -107
- package/.agents/skills/deco-to-tanstack-migration/templates/package-json.md +2 -5
- package/.cursor/rules/migration-tooling-policy.mdc +32 -35
- package/CODEOWNERS +4 -14
- package/MIGRATION_TOOLING_PLAN.md +11 -10
- package/package.json +2 -3
- package/scripts/migrate/phase-scaffold.ts +9 -12
- package/scripts/migrate/phase-verify.ts +3 -5
- package/scripts/migrate/templates/package-json.ts +6 -9
- package/.github/workflows/deploy.yml +0 -122
- package/.github/workflows/preview.yml +0 -142
- package/.github/workflows/sync-secrets.yml +0 -180
- package/deploy/README.md +0 -111
- package/deploy/sites/als-tanstack.jsonc +0 -7
- package/deploy/sites/americanas-tanstack.jsonc +0 -4
- package/deploy/sites/baggagio-tanstack.jsonc +0 -4
- package/deploy/sites/casaevideo-storefront.jsonc +0 -11
- package/deploy/sites/lebiscuit-tanstack.jsonc +0 -19
- package/deploy/sites/miess-01-tanstack.jsonc +0 -8
- package/deploy/wrangler-template.jsonc +0 -28
- package/scripts/deploy/build-wrangler-config.mjs +0 -49
- package/scripts/deploy/jsonc.mjs +0 -76
- package/scripts/deploy/resolve-site.mjs +0 -58
- package/scripts/deploy/site-registry.mjs +0 -142
- package/scripts/deploy/wrangler-wrapper.mjs +0 -126
- package/scripts/migrate/templates/github-workflows.ts +0 -98
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// resolve-site.mjs
|
|
3
|
-
//
|
|
4
|
-
// Validates that the calling repository has a registered site manifest in
|
|
5
|
-
// deco-start, and emits the resolved fields to GITHUB_OUTPUT for downstream
|
|
6
|
-
// steps (wrangler tail, status comments, etc.).
|
|
7
|
-
//
|
|
8
|
-
// Required env:
|
|
9
|
-
// DECO_START_PATH - path to a checked-out deco-start (e.g. ".deco-start")
|
|
10
|
-
// SITE_NAME - typically `${GITHUB_REPOSITORY#*/}` set by the workflow
|
|
11
|
-
//
|
|
12
|
-
// Optional env:
|
|
13
|
-
// GITHUB_OUTPUT - if set, emit `key=value` lines here (CI mode).
|
|
14
|
-
// If unset, prints a human-readable summary to stdout.
|
|
15
|
-
|
|
16
|
-
import { appendFileSync } from "node:fs";
|
|
17
|
-
import { loadSiteManifest } from "./site-registry.mjs";
|
|
18
|
-
|
|
19
|
-
function fail(message) {
|
|
20
|
-
console.error(`::error::${message}`);
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const decoStartPath = process.env.DECO_START_PATH;
|
|
25
|
-
const siteName = process.env.SITE_NAME;
|
|
26
|
-
const ghOutput = process.env.GITHUB_OUTPUT;
|
|
27
|
-
|
|
28
|
-
if (!decoStartPath) fail("DECO_START_PATH env var is required");
|
|
29
|
-
if (!siteName) fail("SITE_NAME env var is required");
|
|
30
|
-
|
|
31
|
-
let manifest;
|
|
32
|
-
try {
|
|
33
|
-
manifest = loadSiteManifest(decoStartPath, siteName);
|
|
34
|
-
} catch (err) {
|
|
35
|
-
fail(err instanceof Error ? err.message : String(err));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const summary = {
|
|
39
|
-
site_name: siteName,
|
|
40
|
-
worker_name: manifest.worker_name,
|
|
41
|
-
has_routes: String(Array.isArray(manifest.routes) && manifest.routes.length > 0),
|
|
42
|
-
has_kv: String(Array.isArray(manifest.kv_namespaces) && manifest.kv_namespaces.length > 0),
|
|
43
|
-
has_analytics: String(
|
|
44
|
-
Array.isArray(manifest.analytics_engine_datasets) &&
|
|
45
|
-
manifest.analytics_engine_datasets.length > 0,
|
|
46
|
-
),
|
|
47
|
-
has_version_metadata: String(Boolean(manifest.version_metadata)),
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
if (ghOutput) {
|
|
51
|
-
const lines = Object.entries(summary).map(([k, v]) => `${k}=${v}`);
|
|
52
|
-
appendFileSync(ghOutput, `${lines.join("\n")}\n`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
console.log(`Resolved site "${siteName}" -> worker "${manifest.worker_name}"`);
|
|
56
|
-
for (const [k, v] of Object.entries(summary)) {
|
|
57
|
-
console.log(` ${k}: ${v}`);
|
|
58
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
// Shared registry helpers for the deploy scripts.
|
|
2
|
-
//
|
|
3
|
-
// `loadSiteManifest(decoStartPath, siteName)` returns the validated
|
|
4
|
-
// per-site manifest object. `mergeWithTemplate(template, site)` deep-merges a
|
|
5
|
-
// site manifest on top of the canonical template and returns the wrangler
|
|
6
|
-
// config object ready for serialization.
|
|
7
|
-
//
|
|
8
|
-
// Trust model: `siteName` is always derived from `${{ github.repository }}` in
|
|
9
|
-
// CI (or from the local git remote in the wrapper CLI), never from a
|
|
10
|
-
// user-supplied input. A site that is not registered in `deploy/sites/` cannot
|
|
11
|
-
// be deployed -- this is enforced here.
|
|
12
|
-
|
|
13
|
-
import { existsSync } from "node:fs";
|
|
14
|
-
import { join } from "node:path";
|
|
15
|
-
import { readJsoncFile } from "./jsonc.mjs";
|
|
16
|
-
|
|
17
|
-
/** @typedef {{
|
|
18
|
-
* worker_name: string;
|
|
19
|
-
* routes?: Array<{ pattern: string; zone_name?: string; custom_domain?: boolean }>;
|
|
20
|
-
* kv_namespaces?: Array<{ binding: string; id: string; preview_id?: string }>;
|
|
21
|
-
* analytics_engine_datasets?: Array<{ binding: string; dataset: string }>;
|
|
22
|
-
* version_metadata?: { binding: string };
|
|
23
|
-
* }} SiteManifest
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
const ALLOWED_SITE_KEYS = new Set([
|
|
27
|
-
"worker_name",
|
|
28
|
-
"routes",
|
|
29
|
-
"kv_namespaces",
|
|
30
|
-
"analytics_engine_datasets",
|
|
31
|
-
"version_metadata",
|
|
32
|
-
]);
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @param {string} decoStartPath
|
|
36
|
-
* @returns {string}
|
|
37
|
-
*/
|
|
38
|
-
export function templatePath(decoStartPath) {
|
|
39
|
-
return join(decoStartPath, "deploy", "wrangler-template.jsonc");
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @param {string} decoStartPath
|
|
44
|
-
* @param {string} siteName
|
|
45
|
-
* @returns {string}
|
|
46
|
-
*/
|
|
47
|
-
export function siteManifestPath(decoStartPath, siteName) {
|
|
48
|
-
return join(decoStartPath, "deploy", "sites", `${siteName}.jsonc`);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @param {string} decoStartPath
|
|
53
|
-
* @param {string} siteName
|
|
54
|
-
* @returns {SiteManifest}
|
|
55
|
-
*/
|
|
56
|
-
export function loadSiteManifest(decoStartPath, siteName) {
|
|
57
|
-
if (!siteName || !/^[a-z0-9][a-z0-9-]*$/.test(siteName)) {
|
|
58
|
-
throw new Error(
|
|
59
|
-
`Refusing to load manifest for invalid site name: ${JSON.stringify(siteName)}. Site names must be lowercase, hyphen-separated.`,
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
const path = siteManifestPath(decoStartPath, siteName);
|
|
63
|
-
if (!existsSync(path)) {
|
|
64
|
-
throw new Error(
|
|
65
|
-
`No registry entry for site "${siteName}" at ${path}.\n` +
|
|
66
|
-
`Add deploy/sites/${siteName}.jsonc to decocms/deco-start before deploying.`,
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
const raw = readJsoncFile(path);
|
|
70
|
-
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
71
|
-
throw new Error(`Site manifest at ${path} must be a JSON object.`);
|
|
72
|
-
}
|
|
73
|
-
const manifest = /** @type {Record<string, unknown>} */ (raw);
|
|
74
|
-
if (typeof manifest.worker_name !== "string" || manifest.worker_name.length === 0) {
|
|
75
|
-
throw new Error(`Site manifest at ${path} is missing the required "worker_name" string.`);
|
|
76
|
-
}
|
|
77
|
-
if (!/^[a-z0-9][a-z0-9-]*$/.test(/** @type {string} */ (manifest.worker_name))) {
|
|
78
|
-
throw new Error(
|
|
79
|
-
`Site manifest at ${path} has an invalid "worker_name": ${JSON.stringify(manifest.worker_name)}. Use lowercase, hyphen-separated.`,
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
for (const key of Object.keys(manifest)) {
|
|
83
|
-
if (!ALLOWED_SITE_KEYS.has(key)) {
|
|
84
|
-
throw new Error(
|
|
85
|
-
`Site manifest at ${path} contains unsupported key "${key}". Allowed: ${[...ALLOWED_SITE_KEYS].join(", ")}.`,
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return /** @type {SiteManifest} */ (manifest);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* @param {string} decoStartPath
|
|
94
|
-
* @returns {Record<string, unknown>}
|
|
95
|
-
*/
|
|
96
|
-
export function loadTemplate(decoStartPath) {
|
|
97
|
-
const path = templatePath(decoStartPath);
|
|
98
|
-
if (!existsSync(path)) {
|
|
99
|
-
throw new Error(`wrangler-template.jsonc not found at ${path}.`);
|
|
100
|
-
}
|
|
101
|
-
const raw = readJsoncFile(path);
|
|
102
|
-
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
103
|
-
throw new Error(`Template at ${path} must be a JSON object.`);
|
|
104
|
-
}
|
|
105
|
-
return /** @type {Record<string, unknown>} */ (raw);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Deep-merge `source` on top of `target`. Arrays in `source` REPLACE arrays in
|
|
110
|
-
* `target` (they are not concatenated) -- this matches the semantics wrangler
|
|
111
|
-
* itself expects for `routes`, `kv_namespaces`, etc.
|
|
112
|
-
*
|
|
113
|
-
* @template T
|
|
114
|
-
* @param {T} target
|
|
115
|
-
* @param {unknown} source
|
|
116
|
-
* @returns {T}
|
|
117
|
-
*/
|
|
118
|
-
function deepMerge(target, source) {
|
|
119
|
-
if (source === null || source === undefined) return target;
|
|
120
|
-
if (Array.isArray(source)) return /** @type {T} */ (source);
|
|
121
|
-
if (typeof source !== "object") return /** @type {T} */ (source);
|
|
122
|
-
const base = target && typeof target === "object" && !Array.isArray(target) ? target : {};
|
|
123
|
-
const out = /** @type {Record<string, unknown>} */ ({ ...base });
|
|
124
|
-
for (const [k, v] of Object.entries(source)) {
|
|
125
|
-
out[k] = deepMerge(out[k], v);
|
|
126
|
-
}
|
|
127
|
-
return /** @type {T} */ (out);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Produce the wrangler config object by deep-merging a site manifest on top of
|
|
132
|
-
* the canonical template. The site's `worker_name` becomes wrangler's `name`.
|
|
133
|
-
*
|
|
134
|
-
* @param {Record<string, unknown>} template
|
|
135
|
-
* @param {SiteManifest} site
|
|
136
|
-
* @returns {Record<string, unknown>}
|
|
137
|
-
*/
|
|
138
|
-
export function mergeWithTemplate(template, site) {
|
|
139
|
-
const { worker_name, ...rest } = site;
|
|
140
|
-
const merged = deepMerge(template, rest);
|
|
141
|
-
return { name: worker_name, ...merged };
|
|
142
|
-
}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// deco-wrangler
|
|
3
|
-
//
|
|
4
|
-
// Local-dev wrapper around `wrangler` for storefront repos that no longer
|
|
5
|
-
// commit a `wrangler.jsonc`. Generates the canonical config from
|
|
6
|
-
// `@decocms/start`'s registry into `./wrangler.jsonc` (gitignored), then
|
|
7
|
-
// optionally execs the real `wrangler` with that config in cwd.
|
|
8
|
-
//
|
|
9
|
-
// Usage from a customer repo (after `npm i -D @decocms/start@latest`):
|
|
10
|
-
//
|
|
11
|
-
// npx deco-wrangler gen # generate ./wrangler.jsonc and exit
|
|
12
|
-
// # (used by predev/prebuild/prepare hooks)
|
|
13
|
-
// npx deco-wrangler tail # tail prod logs (worker name resolved automatically)
|
|
14
|
-
// npx deco-wrangler types # regenerate worker-configuration.d.ts
|
|
15
|
-
// npx deco-wrangler deploy # discouraged in dev; deploys go via CI
|
|
16
|
-
// npx deco-wrangler --help # passes through to wrangler
|
|
17
|
-
//
|
|
18
|
-
// All non-`gen` invocations also (re)generate ./wrangler.jsonc first so the
|
|
19
|
-
// file is always in sync with the registry before wrangler runs. The
|
|
20
|
-
// `@cloudflare/vite-plugin` and the `wrangler` CLI both auto-discover
|
|
21
|
-
// ./wrangler.jsonc in cwd, so no extra config plumbing is required.
|
|
22
|
-
//
|
|
23
|
-
// Site identity (which entry of `deploy/sites/` to load) resolves in this
|
|
24
|
-
// order:
|
|
25
|
-
//
|
|
26
|
-
// 1. DECO_SITE_NAME env var (explicit override)
|
|
27
|
-
// 2. git remote `origin` URL parsed for the GitHub repo name
|
|
28
|
-
// 3. package.json `name` field
|
|
29
|
-
//
|
|
30
|
-
// Fails loudly if none of these match a registered site -- no implicit "guess
|
|
31
|
-
// the worker" behavior. The local wrapper enforces the same trust model the CI
|
|
32
|
-
// pipeline does.
|
|
33
|
-
|
|
34
|
-
import { execSync, spawnSync } from "node:child_process";
|
|
35
|
-
import { readFileSync, writeFileSync } from "node:fs";
|
|
36
|
-
import { dirname, resolve } from "node:path";
|
|
37
|
-
import { fileURLToPath } from "node:url";
|
|
38
|
-
import { loadSiteManifest, loadTemplate, mergeWithTemplate } from "./site-registry.mjs";
|
|
39
|
-
|
|
40
|
-
const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));
|
|
41
|
-
// scripts/deploy/wrangler-wrapper.mjs -> deco-start root
|
|
42
|
-
const DECO_START_PATH = resolve(SCRIPT_DIR, "..", "..");
|
|
43
|
-
|
|
44
|
-
function eprintln(msg) {
|
|
45
|
-
process.stderr.write(`[deco-wrangler] ${msg}\n`);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function tryGitRemoteSiteName() {
|
|
49
|
-
try {
|
|
50
|
-
const url = execSync("git remote get-url origin", {
|
|
51
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
52
|
-
})
|
|
53
|
-
.toString()
|
|
54
|
-
.trim();
|
|
55
|
-
// matches both git@github.com:org/repo(.git) and https://github.com/org/repo(.git)
|
|
56
|
-
const m = url.match(/github\.com[:/][^/]+\/([^/]+?)(?:\.git)?$/);
|
|
57
|
-
return m?.[1];
|
|
58
|
-
} catch {
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function tryPackageJsonName() {
|
|
64
|
-
try {
|
|
65
|
-
const pkg = JSON.parse(readFileSync(resolve(process.cwd(), "package.json"), "utf8"));
|
|
66
|
-
return typeof pkg.name === "string" ? pkg.name : undefined;
|
|
67
|
-
} catch {
|
|
68
|
-
return undefined;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function resolveSiteName() {
|
|
73
|
-
const envName = process.env.DECO_SITE_NAME?.trim();
|
|
74
|
-
if (envName) return { name: envName, source: "DECO_SITE_NAME env var" };
|
|
75
|
-
const gitName = tryGitRemoteSiteName();
|
|
76
|
-
if (gitName) return { name: gitName, source: "git remote origin" };
|
|
77
|
-
const pkgName = tryPackageJsonName();
|
|
78
|
-
if (pkgName) return { name: pkgName, source: "package.json name" };
|
|
79
|
-
return undefined;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const resolved = resolveSiteName();
|
|
83
|
-
if (!resolved) {
|
|
84
|
-
eprintln(
|
|
85
|
-
"Could not determine site name. Set DECO_SITE_NAME or run from a repo with a github.com 'origin' remote.",
|
|
86
|
-
);
|
|
87
|
-
process.exit(1);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
let manifest;
|
|
91
|
-
try {
|
|
92
|
-
manifest = loadSiteManifest(DECO_START_PATH, resolved.name);
|
|
93
|
-
} catch (err) {
|
|
94
|
-
eprintln(err instanceof Error ? err.message : String(err));
|
|
95
|
-
eprintln(`Site name "${resolved.name}" was inferred from ${resolved.source}.`);
|
|
96
|
-
eprintln(
|
|
97
|
-
`If this is a personal sandbox, set DECO_SITE_NAME=<registered-site> or open a PR to deco-start adding deploy/sites/${resolved.name}.jsonc.`,
|
|
98
|
-
);
|
|
99
|
-
process.exit(1);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const merged = mergeWithTemplate(loadTemplate(DECO_START_PATH), manifest);
|
|
103
|
-
|
|
104
|
-
const outputPath = resolve(process.cwd(), "wrangler.jsonc");
|
|
105
|
-
const header = `// AUTOGENERATED by deco-wrangler -- DO NOT COMMIT.
|
|
106
|
-
// Add wrangler.jsonc to .gitignore. Regenerated on every \`deco-wrangler\` run.
|
|
107
|
-
// Source: @decocms/start deploy/sites/${resolved.name}.jsonc + wrangler-template.jsonc
|
|
108
|
-
`;
|
|
109
|
-
writeFileSync(outputPath, `${header}${JSON.stringify(merged, null, 2)}\n`);
|
|
110
|
-
|
|
111
|
-
eprintln(
|
|
112
|
-
`Resolved site "${resolved.name}" -> worker "${manifest.worker_name}" (via ${resolved.source})`,
|
|
113
|
-
);
|
|
114
|
-
eprintln(`Generated ${outputPath}`);
|
|
115
|
-
|
|
116
|
-
const argv = process.argv.slice(2);
|
|
117
|
-
// `gen` mode: just write the config and exit. Used by package.json
|
|
118
|
-
// predev/prebuild/prepare hooks to keep wrangler.jsonc in sync with the
|
|
119
|
-
// registry without invoking wrangler itself.
|
|
120
|
-
if (argv[0] === "gen" || argv[0] === "generate") {
|
|
121
|
-
process.exit(0);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const wranglerArgs = ["wrangler", ...argv];
|
|
125
|
-
const result = spawnSync("npx", wranglerArgs, { stdio: "inherit" });
|
|
126
|
-
process.exit(result.status ?? 1);
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
// Caller workflow stubs for new sites. Each stub delegates to a reusable
|
|
2
|
-
// workflow under `decocms/deco-start/.github/workflows/` -- the customer repo
|
|
3
|
-
// holds no deploy/build logic of its own. See D6 in
|
|
4
|
-
// `.cursor/rules/migration-tooling-policy.mdc` and the `deploy/` directory
|
|
5
|
-
// for the central registry contract.
|
|
6
|
-
|
|
7
|
-
const DEPLOY_YML = `name: Deploy
|
|
8
|
-
|
|
9
|
-
# Thin caller for decocms/deco-start's central deploy workflow.
|
|
10
|
-
|
|
11
|
-
on:
|
|
12
|
-
push:
|
|
13
|
-
branches: [main]
|
|
14
|
-
|
|
15
|
-
permissions:
|
|
16
|
-
contents: write
|
|
17
|
-
|
|
18
|
-
jobs:
|
|
19
|
-
deploy:
|
|
20
|
-
uses: decocms/deco-start/.github/workflows/deploy.yml@v2
|
|
21
|
-
secrets: inherit
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
const PREVIEW_YML = `name: Preview
|
|
25
|
-
|
|
26
|
-
# Thin caller for decocms/deco-start's central preview workflow.
|
|
27
|
-
|
|
28
|
-
on:
|
|
29
|
-
repository_dispatch:
|
|
30
|
-
types: [preview-deploy]
|
|
31
|
-
pull_request:
|
|
32
|
-
types: [opened, synchronize, reopened]
|
|
33
|
-
push:
|
|
34
|
-
branches: ['env/**']
|
|
35
|
-
|
|
36
|
-
permissions:
|
|
37
|
-
contents: read
|
|
38
|
-
pull-requests: write
|
|
39
|
-
statuses: write
|
|
40
|
-
|
|
41
|
-
jobs:
|
|
42
|
-
preview:
|
|
43
|
-
uses: decocms/deco-start/.github/workflows/preview.yml@v2
|
|
44
|
-
secrets: inherit
|
|
45
|
-
`;
|
|
46
|
-
|
|
47
|
-
const REGEN_BLOCKS_YML = `name: Regenerate blocks.gen.json
|
|
48
|
-
|
|
49
|
-
# Thin caller for decocms/deco-start's central regen-blocks workflow.
|
|
50
|
-
|
|
51
|
-
on:
|
|
52
|
-
push:
|
|
53
|
-
branches: [main]
|
|
54
|
-
paths:
|
|
55
|
-
- ".deco/blocks/**"
|
|
56
|
-
|
|
57
|
-
permissions:
|
|
58
|
-
contents: write
|
|
59
|
-
|
|
60
|
-
jobs:
|
|
61
|
-
regen:
|
|
62
|
-
uses: decocms/deco-start/.github/workflows/regen-blocks.yml@v2
|
|
63
|
-
secrets: inherit
|
|
64
|
-
`;
|
|
65
|
-
|
|
66
|
-
const SYNC_SECRETS_YML = `name: Sync worker secrets
|
|
67
|
-
|
|
68
|
-
# Thin caller for decocms/deco-start's central sync-secrets workflow.
|
|
69
|
-
|
|
70
|
-
on:
|
|
71
|
-
workflow_dispatch:
|
|
72
|
-
inputs:
|
|
73
|
-
mode:
|
|
74
|
-
description: "dry-run = print diff only | apply = set secrets on worker"
|
|
75
|
-
required: true
|
|
76
|
-
default: "dry-run"
|
|
77
|
-
type: choice
|
|
78
|
-
options: [dry-run, apply]
|
|
79
|
-
|
|
80
|
-
permissions:
|
|
81
|
-
contents: read
|
|
82
|
-
|
|
83
|
-
jobs:
|
|
84
|
-
sync:
|
|
85
|
-
uses: decocms/deco-start/.github/workflows/sync-secrets.yml@v2
|
|
86
|
-
with:
|
|
87
|
-
mode: \${{ inputs.mode }}
|
|
88
|
-
secrets: inherit
|
|
89
|
-
`;
|
|
90
|
-
|
|
91
|
-
export function generateGithubWorkflows(): Record<string, string> {
|
|
92
|
-
return {
|
|
93
|
-
".github/workflows/deploy.yml": DEPLOY_YML,
|
|
94
|
-
".github/workflows/preview.yml": PREVIEW_YML,
|
|
95
|
-
".github/workflows/regen-blocks.yml": REGEN_BLOCKS_YML,
|
|
96
|
-
".github/workflows/sync-secrets.yml": SYNC_SECRETS_YML,
|
|
97
|
-
};
|
|
98
|
-
}
|