Repository navigation
Expand file tree
/
Copy pathrelease.config.js
More file actions
141 lines (131 loc) · 5.68 KB
/
Copy pathrelease.config.js
File metadata and controls
141 lines (131 loc) · 5.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/**
* @type {import('semantic-release').GlobalConfig}
*/
// PROD-8359 kill-switch (see scripts/gen-release-safety.ts). While the marker is
// dark-launched (RELEASE_SAFETY_MARKER_ENABLED !== "true") the generator leaves the
// committed unknown placeholder unchanged, and GitHub asset publication stays off.
const releaseSafetyMarkerEnabled =
process.env.RELEASE_SAFETY_MARKER_ENABLED === 'true';
module.exports = {
branches: [
'+([0-9])?(.{+([0-9]),x}).x',
'main',
'next',
'next-major',
{ name: 'beta', prerelease: true },
{ name: 'alpha', prerelease: true },
],
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
[
'@semantic-release/changelog',
{
changelogFile: 'CHANGELOG.md',
},
],
[
'@semantic-release/exec',
{
prepareCmd:
'npm version ${nextRelease.version} --workspaces --include-workspace-root --allow-same-version --no-git-tag-version 2>&1 | grep -q -E "EUNSUPPORTEDPROTOCOL|Invalid comparator"',
},
],
// npm version starts reifying node_modules toward npm's ideal tree
// (destroying parts of pnpm's symlink layout) before it hits the
// expected workspace:* error above. Reinstall from the unchanged
// lockfile to repair the tree; pnpm 11 used to do this implicitly via
// verifyDepsBeforeRun before it was pinned off in pnpm-workspace.yaml.
// Store-first with network fallback: strict --offline failed because
// the runner store lacks some lockfile tarballs even after the job's
// install step (run 30492147529, ERR_PNPM_NO_OFFLINE_TARBALL). No sfw
// wrapper: its crashed proxy masked a failed install with exit 0 (run
// 30491182209); plain pnpm re-fetches lockfile-pinned, integrity-
// checked packages with its own retries and honest exit codes.
[
'@semantic-release/exec',
{
prepareCmd: 'pnpm install --prefer-offline',
},
],
[
'@semantic-release/exec',
{
prepareCmd:
'pnpm generate-api:backend',
},
],
// Generate the release-safety marker (PROD-8359). Runs before the github
// plugin so the asset exists at publish time.
//
// --rest-from-tag diffs the OpenAPI spec of the previous tag against the
// working-tree one regenerated by the `pnpm generate-api:backend` step
// above. It is explicit because the PR-time preview has to generate both
// sides instead, and neither caller should silently get the other's
// comparison. Without it the REST surface is reported as not checked.
//
// --ai-review activates the gated AI rolling-update review (P6). It runs
// on every migration-bearing release and on flagged REST/MCP breaks; a
// definitive verdict can clear or confirm the deterministic floor. It is
// gated on ANTHROPIC_API_KEY in the release job. Any degrade leaves the
// floor or honest "unknown" verdict intact; it never fails the release.
[
'@semantic-release/exec',
{
prepareCmd:
'pnpm exec tsx scripts/gen-release-safety.ts --version ${nextRelease.version} --previous-version "${lastRelease.version}" --last-tag "${lastRelease.gitTag}" --out release-safety.json --index release-safety-index.json --rest-from-tag --ai-review',
},
],
[
'@semantic-release/exec',
{
prepareCmd:
'pnpm exec tsx scripts/release-safety-schema.test.ts',
},
],
'./scripts/semantic-release-safety-plugin.js',
[
'@semantic-release/git',
{
assets: [
'CHANGELOG.md',
'package.json',
'packages/backend/package.json',
'packages/cli/package.json',
'packages/common/package.json',
'packages/e2e/package.json',
'packages/frontend/package.json',
'packages/warehouses/package.json',
'packages/query-sdk/package.json',
'packages/frontend/sdk/package.json',
'packages/backend/src/generated/routes.ts',
'packages/backend/src/generated/swagger.json',
// PROD-8359: when the marker generator auto-records this
// release's expand/contract upgrade floor, the change to this
// committed file ships in the release commit so future releases
// carry the floor forward. Unchanged (the common case) → no-op.
'release-safety.overrides.json',
'release-safety.json',
'release-safety-index.json',
],
message:
'chore(release): ${nextRelease.version} \n\n${nextRelease.notes}',
},
],
[
'@semantic-release/github',
{
// Attach the marker only when the kill-switch is on (see above).
assets: releaseSafetyMarkerEnabled
? [
{
path: 'release-safety.json',
label: 'release-safety.json',
},
]
: [],
},
],
],
tagFormat: '${version}',
};