Merge pull request 'fix: auto-discover publishable packages + pre-publish test gate' (#236) from fix/auto-discover-publish into main

This commit is contained in:
2026-05-13 09:42:55 +00:00
+11 -36
View File
@@ -13,8 +13,7 @@ set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$REPO_ROOT" cd "$REPO_ROOT"
GITEA_TOKEN="${GITEA_TOKEN:?GITEA_TOKEN is required}" GITEA_TOKEN="${GITEA_TOKEN:?GITEA_TOKEN is required}" # needed by .npmrc
GITEA_NPM_REGISTRY="https://git.shazhou.work/api/packages/uncaged/npm/"
# ─── Version ───────────────────────────────────────────────────────────────── # ─── Version ─────────────────────────────────────────────────────────────────
current_version() { current_version() {
@@ -36,24 +35,6 @@ CURRENT=$(current_version)
VERSION=$(bump_version "$CURRENT" "${1:?Usage: publish.sh <version|patch|minor|major>}") VERSION=$(bump_version "$CURRENT" "${1:?Usage: publish.sh <version|patch|minor|major>}")
echo "📦 Publish: $CURRENT$VERSION" echo "📦 Publish: $CURRENT$VERSION"
# ─── Topological publish order ───────────────────────────────────────────────
PUBLISH_ORDER=(
workflow-protocol
workflow-util
workflow-cas
workflow-runtime
workflow-reactor
workflow-register
workflow-execute
cli-workflow
workflow-util-agent
workflow-agent-cursor
workflow-agent-hermes
workflow-agent-llm
workflow-template-develop
workflow-template-solve-issue
)
# ─── Bump version ──────────────────────────────────────────────────────────── # ─── Bump version ────────────────────────────────────────────────────────────
echo "🔢 Bumping versions..." echo "🔢 Bumping versions..."
for dir in packages/*/; do for dir in packages/*/; do
@@ -92,22 +73,16 @@ done
echo "🔨 Building..." echo "🔨 Building..."
npm run build npm run build
# ─── Publish ───────────────────────────────────────────────────────────────── # ─── Self-test ────────────────────────────────────────────────────────────────
echo "🚀 Publishing..." echo "🧪 Running tests..."
cat > "$REPO_ROOT/.npmrc" <<EOF if ! bun test; then
@uncaged:registry=${GITEA_NPM_REGISTRY} echo "❌ Tests failed — aborting publish"
//${GITEA_NPM_REGISTRY#https://}:_authToken=${GITEA_TOKEN} exit 1
EOF fi
FAIL=0 # ─── Publish (delegate to publish-all.sh) ────────────────────────────────────
for pkg_dir in "${PUBLISH_ORDER[@]}"; do echo "🚀 Publishing via publish-all.sh..."
if (cd "packages/$pkg_dir" && npm publish 2>&1); then "$REPO_ROOT/scripts/publish-all.sh"
echo " ✅ @uncaged/$pkg_dir@$VERSION"
else
echo " ❌ @uncaged/$pkg_dir"
FAIL=1
fi
done
# ─── Restore workspace:* ───────────────────────────────────────────────────── # ─── Restore workspace:* ─────────────────────────────────────────────────────
echo "🔄 Restoring workspace:*..." echo "🔄 Restoring workspace:*..."
@@ -136,4 +111,4 @@ git commit -m "chore: publish v${VERSION}
小橘 <xiaoju@shazhou.work>" 小橘 <xiaoju@shazhou.work>"
git push git push
[[ "$FAIL" -eq 0 ]] && echo "✅ v${VERSION} published" || echo "⚠️ v${VERSION} published with errors" echo "✅ v${VERSION} published"