Compare commits

..

1 Commits

Author SHA1 Message Date
Jarvis
e349ec6956 ci: add durable next publish pipeline 2026-06-25 00:00:55 -05:00

View File

@@ -141,7 +141,7 @@ steps:
echo "//git.mosaicstack.dev/api/packages/mosaicstack/npm/:_authToken=$NPM_TOKEN" > ~/.npmrc echo "//git.mosaicstack.dev/api/packages/mosaicstack/npm/:_authToken=$NPM_TOKEN" > ~/.npmrc
echo "@mosaicstack:registry=https://git.mosaicstack.dev/api/packages/mosaicstack/npm/" >> ~/.npmrc echo "@mosaicstack:registry=https://git.mosaicstack.dev/api/packages/mosaicstack/npm/" >> ~/.npmrc
DIST_TAGS_JSON="$(npm view @mosaicstack/mosaic dist-tags --registry https://git.mosaicstack.dev/api/packages/mosaicstack/npm/ --json)" DIST_TAGS_JSON="$(npm view @mosaicstack/mosaic dist-tags --registry https://git.mosaicstack.dev/api/packages/mosaicstack/npm/ --json)"
DIST_TAGS_JSON="$DIST_TAGS_JSON" node -e 'const tags = JSON.parse(process.env.DIST_TAGS_JSON || "{}"); if (!tags || typeof tags !== "object" || !Object.hasOwn(tags, "latest")) { throw new Error("Gitea npm registry did not return a usable dist-tags object"); } console.log("[publish-next] registry dist-tags OK: latest=" + tags.latest);' DIST_TAGS_JSON="$DIST_TAGS_JSON" node -e 'const tags = JSON.parse(process.env.DIST_TAGS_JSON || "{}"); if (!tags || typeof tags !== "object" || !Object.hasOwn(tags, "latest")) { throw new Error("Gitea npm registry did not return a usable dist-tags object"); } console.log(`[publish-next] registry dist-tags OK: latest=${tags.latest}`);'
node <<'NODE' node <<'NODE'
const fs = require('node:fs'); const fs = require('node:fs');
const path = require('node:path'); const path = require('node:path');
@@ -168,19 +168,19 @@ steps:
if (!manifest.name?.startsWith('@mosaicstack/') || manifest.private) return; if (!manifest.name?.startsWith('@mosaicstack/') || manifest.private) return;
const stableMatch = /^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(manifest.version); const stableMatch = /^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(manifest.version);
if (!stableMatch) { if (!stableMatch) {
throw new Error(manifest.name + " has unsupported semver version '" + manifest.version + "'"); throw new Error(`${manifest.name} has unsupported semver version '${manifest.version}'`);
} }
const [, major, minor, patch] = stableMatch; const [, major, minor, patch] = stableMatch;
const oldVersion = manifest.version; const oldVersion = manifest.version;
manifest.version = major + '.' + minor + '.' + (Number(patch) + 1) + '-next.' + pipelineNumber; manifest.version = `${major}.${minor}.${Number(patch) + 1}-next.${pipelineNumber}`;
fs.writeFileSync(packagePath, JSON.stringify(manifest, null, 2) + '\n'); fs.writeFileSync(packagePath, `${JSON.stringify(manifest, null, 2)}\n`);
updated.push(manifest.name + ' ' + oldVersion + ' -> ' + manifest.version); updated.push(`${manifest.name} ${oldVersion} -> ${manifest.version}`);
} }
for (const root of roots) walk(root); for (const root of roots) walk(root);
if (updated.length === 0) throw new Error('No publishable @mosaicstack/* packages found'); if (updated.length === 0) throw new Error('No publishable @mosaicstack/* packages found');
console.log('[publish-next] computed prerelease versions for ' + updated.length + ' packages:'); console.log(`[publish-next] computed prerelease versions for ${updated.length} packages:`);
for (const line of updated) console.log('[publish-next] ' + line); for (const line of updated) console.log(`[publish-next] ${line}`);
NODE NODE
pnpm --filter "@mosaicstack/*" --filter "!@mosaicstack/web" --filter "!@mosaicstack/mosaic-as" publish --no-git-checks --access public --tag next pnpm --filter "@mosaicstack/*" --filter "!@mosaicstack/web" --filter "!@mosaicstack/mosaic-as" publish --no-git-checks --access public --tag next
EXPECTED_VERSION="$(node -p "require('./packages/mosaic/package.json').version")" EXPECTED_VERSION="$(node -p "require('./packages/mosaic/package.json').version")"