fix(release): complete wrapper prerequisites

Partial backports from 9d2d517296 and a1201e99fc, adapted for the preflight-only rehearsal workflow.
This commit is contained in:
Dallin Romney
2026-07-09 19:52:18 -07:00
parent a9d74d31ea
commit b602e1de4c
5 changed files with 90 additions and 21 deletions
+26 -2
View File
@@ -24,7 +24,7 @@ export const JUNE_2026_PATCH_FLOOR = 5;
/**
* @typedef {object} NpmPublishPlan
* @property {"stable" | "alpha" | "beta"} channel
* @property {"latest" | "alpha" | "beta"} publishTag
* @property {"latest" | "alpha" | "beta" | "extended-stable"} publishTag
* @property {("latest" | "alpha" | "beta")[]} mirrorDistTags
*/
@@ -186,14 +186,38 @@ export function compareReleaseVersions(left, right) {
/**
* @param {string} version
* @param {string | null} [currentBetaVersion]
* @param {string | null} [publishTagOverride]
* @returns {NpmPublishPlan}
*/
export function resolveNpmPublishPlan(version, currentBetaVersion) {
export function resolveNpmPublishPlan(version, currentBetaVersion, publishTagOverride) {
const parsedVersion = parseReleaseVersion(version);
if (parsedVersion === null) {
throw new Error(`Unsupported release version "${version}".`);
}
const normalizedOverride = publishTagOverride?.trim();
if (normalizedOverride && normalizedOverride !== "extended-stable") {
throw new Error(
`Unsupported npm publish tag override "${normalizedOverride}". Expected "extended-stable".`,
);
}
if (normalizedOverride === "extended-stable") {
if (
parsedVersion.channel !== "stable" ||
parsedVersion.correctionNumber !== undefined ||
parsedVersion.patch < 33
) {
throw new Error(
`Extended-stable npm publication requires a final YYYY.M.PATCH version with PATCH >= 33; found "${version}".`,
);
}
return {
channel: "stable",
publishTag: "extended-stable",
mirrorDistTags: [],
};
}
if (parsedVersion.channel === "beta") {
return {
channel: "beta",
+26 -4
View File
@@ -2,11 +2,33 @@
set -euo pipefail
mode="${1:-}"
publish_target="${2:-}"
usage() {
echo "usage: bash scripts/openclaw-npm-publish.sh --publish [package.tgz]"
}
if [[ "${mode}" != "--publish" ]]; then
echo "usage: bash scripts/openclaw-npm-publish.sh --publish [package.tgz]" >&2
if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then
usage
exit 0
fi
if [[ "${1:-}" != "--publish" ]]; then
usage >&2
exit 2
fi
shift
publish_target=""
if [[ "${1:-}" == "--" ]]; then
shift
fi
if [[ "$#" -gt 0 ]]; then
case "$1" in
-*) echo "error: unexpected npm publish target option: $1" >&2; exit 2 ;;
*) publish_target="$1"; shift ;;
esac
fi
if [[ "$#" -gt 0 ]]; then
echo "error: unexpected npm publish argument: $1" >&2
exit 2
fi
+1
View File
@@ -63,6 +63,7 @@ import {
const plan = resolveNpmPublishPlan(
process.env.PACKAGE_VERSION ?? "",
process.env.CURRENT_BETA_VERSION,
process.env.OPENCLAW_PLUGIN_NPM_PUBLISH_TAG,
);
const auth = resolveNpmDistTagMirrorAuth({
nodeAuthToken: process.env.NODE_AUTH_TOKEN,