mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-22 18:35:21 -06:00
fix(release): complete wrapper prerequisites
Partial backports from9d2d517296anda1201e99fc, adapted for the preflight-only rehearsal workflow.
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user