4 Commits
Author SHA1 Message Date
chrnx 5fccd3cc8c Merge pull request 'fix(release): validate npm provenance and mutable staging' (#14) from hotfix/npm-release-provenance into develop
CI / build (push) Successful in 33s
Reviewed-on: #14
2026-08-03 03:44:11 +00:00
chrnx 9398a5a2df fix(ci): keep Verdaccio staging mutable
CI / build (pull_request) Successful in 34s
Replace an existing prerelease before publishing the refreshed candidate. Verdaccio remains mutable for validation while npmjs release versions stay immutable.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-08-02 22:42:39 -05:00
chrnx 29aafde84c fix(ci): make Verdaccio staging idempotent
CI / build (pull_request) Successful in 32s
Stage only release branches and preserve immutable versions. Repeated identical candidates now exit successfully, while content changes under an existing version require a prerelease bump.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-08-02 22:38:56 -05:00
chrnx dbb996dd4c fix(package): declare npm publication metadata
Link the package to its public source, issue tracker, and documentation so npm Trusted Publishing can validate provenance and consumers receive canonical project links.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-08-02 22:38:47 -05:00
4 changed files with 72 additions and 10 deletions

No files matched your search

+14 -10
View File
@@ -1,13 +1,12 @@
name: Stage → Verdaccio name: Stage → Verdaccio
# Staging publish. Runs on GITEA ONLY (the `if` guards against GitHub), on every merge # Staging publish. Runs on GITEA ONLY (the `if` guards against GitHub) for release
# to main. Publishes the package as-is — version comes from package.json (a prerelease # branches. Publishes prereleases to the internal Verdaccio under the `stg` dist-tag.
# like 26.7.1-beta.N) — to the internal Verdaccio under the `stg` dist-tag. This registry # Staging versions are intentionally mutable: an existing prerelease is removed before
# rejects overwriting an existing version, so the step unpublishes it first (a no-op on the # publishing the updated release candidate under the same version.
# first publish) then publishes fresh.
on: on:
push: push:
branches: [main] branches: ['release/**']
jobs: jobs:
publish-stg: publish-stg:
@@ -19,13 +18,18 @@ jobs:
with: with:
node-version: '22' node-version: '22'
- run: npm ci - run: npm ci
# `npm publish` runs prepublishOnly (lint + complexity + typecheck + test + build) - run: npm audit
# as its own gate before anything leaves the machine. - name: Validate release candidate
- name: Publish to Verdaccio (unpublish + publish) run: npm run prepublishOnly
- name: Publish prerelease to Verdaccio
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH }} NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH }}
run: | run: |
npm config set //npm.svc.zoit.services/:_authToken "$NODE_AUTH_TOKEN" npm config set //npm.svc.zoit.services/:_authToken "$NODE_AUTH_TOKEN"
VER=$(node -p "require('./package.json').version") VER=$(node -p "require('./package.json').version")
case "$VER" in
*-*) ;;
*) echo "Refusing to stage non-prerelease version: $VER" >&2; exit 1 ;;
esac
npm unpublish "@green-tea/core@$VER" --registry https://npm.svc.zoit.services --force 2>/dev/null || true npm unpublish "@green-tea/core@$VER" --registry https://npm.svc.zoit.services --force 2>/dev/null || true
npm publish --registry https://npm.svc.zoit.services --tag stg npm publish --ignore-scripts --registry https://npm.svc.zoit.services --tag stg
+8
View File
@@ -4,6 +4,14 @@
"description": "A zen, opinionated, type-safe framework — your API is a graph, not a middleware chain.", "description": "A zen, opinionated, type-safe framework — your API is a graph, not a middleware chain.",
"license": "MIT", "license": "MIT",
"author": "green-tea contributors", "author": "green-tea contributors",
"repository": {
"type": "git",
"url": "git+https://github.com/Expressive-Tea/green-tea.git"
},
"bugs": {
"url": "https://github.com/Expressive-Tea/green-tea/issues"
},
"homepage": "https://green-tea.expressive-tea.io/docs/",
"keywords": [ "keywords": [
"http", "http",
"framework", "framework",
+33
View File
@@ -0,0 +1,33 @@
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
interface PackageMetadata {
readonly repository?: {
readonly type?: string;
readonly url?: string;
};
readonly bugs?: {
readonly url?: string;
};
readonly homepage?: string;
}
const packageJson = JSON.parse(readFileSync(resolve(process.cwd(), 'package.json'), 'utf8')) as PackageMetadata;
describe('package publication metadata', () => {
it('links npm provenance to the public GitHub repository', () => {
expect(packageJson.repository).toEqual({
type: 'git',
url: 'git+https://github.com/Expressive-Tea/green-tea.git',
});
});
it('links npm consumers to support and documentation', () => {
expect(packageJson.bugs).toEqual({
url: 'https://github.com/Expressive-Tea/green-tea/issues',
});
expect(packageJson.homepage).toBe('https://green-tea.expressive-tea.io/docs/');
});
});
+17
View File
@@ -0,0 +1,17 @@
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
const workflow = readFileSync(resolve(process.cwd(), '.github/workflows/stage.yml'), 'utf8');
describe('Verdaccio staging workflow', () => {
it('replaces mutable prereleases only from release branches', () => {
expect(workflow).toContain("branches: ['release/**']");
expect(workflow).toContain('npm audit');
expect(workflow).toContain('npm run prepublishOnly');
expect(workflow).toContain('npm unpublish');
expect(workflow).toContain('npm publish --ignore-scripts');
expect(workflow).not.toContain('scripts/staging-integrity.ts');
});
});