first commit
Some checks failed
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Some checks failed
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
91
.github/scripts/detect-new-packages.mjs
vendored
Normal file
91
.github/scripts/detect-new-packages.mjs
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* Detects packages in the monorepo that have not yet been published to npm.
|
||||
*
|
||||
* Packages that are new (never published) cannot be released via OIDC Trusted
|
||||
* Publishing because Trusted Publishing requires the package to already exist
|
||||
* on npm with the publisher configured first.
|
||||
*
|
||||
* New packages must be handled manually:
|
||||
* 1. Published once using an NPM token
|
||||
* 2. Configured with Trusted Publishing on npmjs.com
|
||||
*
|
||||
* Exit codes:
|
||||
* 0 – All public packages exist on npm
|
||||
* 1 – One or more public packages have never been published
|
||||
*/
|
||||
|
||||
import child_process from 'child_process';
|
||||
import { promisify } from 'util';
|
||||
|
||||
const exec = promisify(child_process.exec);
|
||||
|
||||
const packages = JSON.parse((await exec('pnpm ls -r --only-projects --json')).stdout);
|
||||
|
||||
const newPackages = [];
|
||||
|
||||
for (const { name, private: isPrivate } of packages) {
|
||||
if (isPrivate) continue;
|
||||
|
||||
// Scoped packages must be encoded: @n8n/foo → @n8n%2Ffoo
|
||||
const encodedName = name.startsWith('@') ? name.replace('/', '%2F') : name;
|
||||
const url = `https://registry.npmjs.org/${encodedName}`;
|
||||
|
||||
try {
|
||||
const response = await fetch(url, { method: 'HEAD' });
|
||||
if (response.status === 404) {
|
||||
newPackages.push(name);
|
||||
} else if (!response.ok && response.status !== 405) {
|
||||
// 405 = Method Not Allowed for HEAD (some registries), not an error
|
||||
console.log(
|
||||
`::warning::Unexpected HTTP ${response.status} when checking npm registry for "${name}". Skipping check.`,
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(
|
||||
`::warning::Could not reach npm registry for "${name}": ${error.message}. Skipping check.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (newPackages.length === 0) {
|
||||
const publicCount = packages.filter((p) => !p.private).length;
|
||||
console.log(`✅ All ${publicCount} public packages exist on npm.`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
console.log(`
|
||||
|
||||
❌ New unpublished packages detected!
|
||||
|
||||
The following packages do not yet exist on npm and cannot be published via
|
||||
OIDC Trusted Publishing until they have been published at least once manually:
|
||||
|
||||
`);
|
||||
|
||||
for (const pkg of newPackages) {
|
||||
console.log(` - ${pkg}`);
|
||||
console.log(
|
||||
`::error::Package "${pkg}" has never been published to npm. A manual first-publish with an NPM token is required before it can use OIDC Trusted Publishing.`,
|
||||
);
|
||||
}
|
||||
|
||||
console.log(`
|
||||
Steps to unblock the release, for each new package listed above:
|
||||
|
||||
1. Publish the package once manually using an NPM token:
|
||||
cd to/where/package/lives
|
||||
pnpm login
|
||||
pnpm publish --access public
|
||||
|
||||
2. Configure Trusted Publishing on npmjs.com for each new package:
|
||||
https://docs.npmjs.com/trusted-publishers
|
||||
|
||||
Use the following settings:
|
||||
Repository owner : n8n-io
|
||||
Repository name : n8n
|
||||
Workflow filename: release-publish.yml
|
||||
|
||||
3. Re-run the Release: Publish workflow.
|
||||
|
||||
`);
|
||||
process.exit(1);
|
||||
Reference in New Issue
Block a user