Skip to content

Commit 2b17df1

Browse files
FoscatFoscat
andauthored
chore: add 2.0.4 release verification gate (#42)
Co-authored-by: Foscat <fosterkyle6356@gmail.com>
1 parent 507c475 commit 2b17df1

3 files changed

Lines changed: 30 additions & 5 deletions

File tree

docs/PUBLISHING.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
## Dry run
44

55
```bash
6-
npm run check
7-
npm run pack:dry-run
6+
npm run release:verify
87
```
98

9+
`npm run release:verify` is the non-publishing hotfix release gate. It runs `npm run check`, `npm run test:e2e`, `npm run test:visual`, `npm audit --audit-level=moderate`, and `npm run pack:dry-run`.
10+
1011
`npm run check` rebuilds dist CSS, runs stylelint, executes package, class API, shared theme-color, and vendor-prefix unit checks, validates core text/link contrast pairs and filled component `on-*` contrast pairs, and confirms package metadata. `npm run pack:dry-run` shows the exact files that would publish.
1112

1213
`npm run build` uses the exactly pinned Lightning CSS parser-minifier. Generated minified bundles retain the release banner while preserving grammar-sensitive selector and `calc()` whitespace.
@@ -15,11 +16,13 @@ The npm artifact is library-focused: `dist/`, `styles/`, docs, and metadata. Dem
1516

1617
## Publish
1718

19+
No package, tag, or registry release occurs without explicit approval.
20+
1821
```bash
1922
npm publish
2023
```
2124

22-
For GitHub releases, create or dispatch a release for the matching package tag, such as `v2.0.4`. The release workflows verify that `package.json`, `package-lock.json`, `CHANGELOG.md`, and generated dist banners are aligned before publishing.
25+
`prepublishOnly` runs `npm run release:verify`, so a direct `npm publish` still has the full hotfix release gate. For GitHub releases, create or dispatch a release for the matching package tag, such as `v2.0.4`. The release workflows verify that `package.json`, `package-lock.json`, `CHANGELOG.md`, and generated dist banners are aligned before publishing.
2326

2427
## Versioning
2528

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@
154154
"check": "npm run build && npm run lint && npm run test:unit && npm run check:contrast && npm run check:package",
155155
"pack:dry-run": "npm pack --dry-run",
156156
"prepack": "npm run check",
157-
"prepublishOnly": "npm run check",
157+
"release:verify": "npm run check && npm run test:e2e && npm run test:visual && npm audit --audit-level=moderate && npm run pack:dry-run",
158+
"prepublishOnly": "npm run release:verify",
158159
"release:patch": "npm version patch && npm publish",
159160
"release:minor": "npm version minor && npm publish",
160161
"release:major": "npm version major && npm publish",

tests/package-integrity.test.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ test('release automation scripts are exposed', () => {
296296
'check:contrast',
297297
'check:package',
298298
'check',
299-
'pack:dry-run'
299+
'pack:dry-run',
300+
'release:verify'
300301
];
301302

302303
for (const scriptName of requiredScripts) {
@@ -305,6 +306,26 @@ test('release automation scripts are exposed', () => {
305306
}
306307
});
307308

309+
test('release verification script is non-publishing and covers the 2.0.4 release gate', () => {
310+
const releaseVerify = packageJson.scripts['release:verify'] ?? '';
311+
const requiredCommands = [
312+
'npm run check',
313+
'npm run test:e2e',
314+
'npm run test:visual',
315+
'npm audit --audit-level=moderate',
316+
'npm run pack:dry-run'
317+
];
318+
319+
for (const command of requiredCommands) {
320+
assert.match(releaseVerify, new RegExp(escapeRegExp(command)), `release:verify should run ${command}`);
321+
}
322+
323+
// Keep the hotfix verification gate safe for approval-gated release preparation.
324+
assert.doesNotMatch(releaseVerify, /\bnpm\s+(?:publish|version)\b/);
325+
assert.doesNotMatch(releaseVerify, /\bgit\s+tag\b/);
326+
assert.equal(packageJson.scripts.prepublishOnly, 'npm run release:verify');
327+
});
328+
308329
test('package metadata is aligned for the release version', () => {
309330
assert.equal(packageLock.version, packageJson.version);
310331
assert.equal(packageLock.packages[''].version, packageJson.version);

0 commit comments

Comments
 (0)