Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix(ci): avoid generated branches for plugin releases (#4242)
LinQiang39154171182da8a
diff --git a/.github/workflows/clawhub-dev-release.yml b/.github/workflows/clawhub-dev-release.ymlindex 9e37d0a7f..0fd72bc03 100644--- a/.github/workflows/clawhub-dev-release.yml+++ b/.github/workflows/clawhub-dev-release.yml@@ -1,10 +1,10 @@name: OpenViking OpenClaw plugin release# Publishes examples/openclaw-plugin as @openviking/openclaw-plugin. The-# publish branch intentionally does not commit dist/; this workflow builds the-# plugin once, publishes a legacy zip artifact to ClawHub for old OpenClaw-# compatibility, and publishes the npm-packed tarball to npm. Keep these split-# until ClawHub legacy /download hashes are compatible with npm-pack releases.+# workflow publishes a legacy zip artifact to ClawHub for old OpenClaw+# compatibility and publishes the npm-packed tarball to npm without creating+# generated package branches in the repository. Keep these split until ClawHub+# legacy /download hashes are compatible with npm-pack releases.on:push:@@ -69,6 +69,7 @@ jobs:id: resolveshell: bashrun: |+ set -euo pipefailrepo="${{ github.repository }}"requested="${{ github.event.inputs.channel || 'auto' }}"requested_version="${{ github.event.inputs.version || '' }}"@@ -131,25 +132,54 @@ jobs:ficollect_published_versions() {- local target_repo="$1"- local remote="https://x-access-token:${{ github.token }}@github.com/${target_repo}.git"- local tmpdir- tmpdir="$(mktemp -d)"- git -C "$tmpdir" init -q- git -C "$tmpdir" remote add origin "$remote"- if git -C "$tmpdir" fetch --quiet --depth=1 origin '+refs/heads/clawhub-package-*:refs/remotes/origin/clawhub-package-*'; then- git -C "$tmpdir" for-each-ref --format='%(refname)' refs/remotes/origin/clawhub-package-* | while IFS= read -r ref; do- branch_version="$(- git -C "$tmpdir" show "$ref:package.json" 2>/dev/null \- | sed -n 's/^[[:space:]]*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' \- | head -n 1 || true- )"- if [ -n "$branch_version" ]; then- echo "$branch_version"- fi- done- fi- rm -rf "$tmpdir"+ python3 - <<'PY'+ import json+ import time+ import urllib.error+ import urllib.parse+ import urllib.request++ package_name = "@openviking/openclaw-plugin"+ versions = set()++ def fetch_json(url):+ for attempt in range(1, 5):+ try:+ request = urllib.request.Request(+ url,+ headers={"Accept": "application/json", "User-Agent": "OpenViking-release-workflow"},+ )+ with urllib.request.urlopen(request, timeout=30) as response:+ return json.load(response)+ except (OSError, urllib.error.HTTPError, urllib.error.URLError, json.JSONDecodeError):+ if attempt == 4:+ raise+ time.sleep(attempt * 2)++ encoded_name = urllib.parse.quote(package_name, safe="")+ npm_data = fetch_json(f"https://registry.npmjs.org/{encoded_name}")+ versions.update((npm_data.get("versions") or {}).keys())++ cursor = None+ while True:+ query = {"limit": "100"}+ if cursor:+ query["cursor"] = cursor+ clawhub_data = fetch_json(+ f"https://clawhub.ai/api/v1/packages/{encoded_name}/versions?"+ + urllib.parse.urlencode(query)+ )+ for item in clawhub_data.get("items") or []:+ version = item.get("version")+ if isinstance(version, str) and version:+ versions.add(version)+ cursor = clawhub_data.get("nextCursor")+ if not cursor:+ break++ for version in sorted(versions):+ print(version)+ PY}next_version_for_channel() {@@ -157,7 +187,7 @@ jobs:local base_versionlocal existing_versionsbase_version="$(TZ="$release_timezone" date +'%Y.%-m.%-d')"- existing_versions="$(collect_published_versions "$repo" | sort -u)"+ existing_versions="$(collect_published_versions | sort -u)"if [ "$channel" = "dev" ]; thenlocal prefix="${base_version}-dev."@@ -232,10 +262,8 @@ jobs:timeout-minutes: 15permissions:actions: read- contents: write+ contents: readoutputs:- package_branch: ${{ steps.package_branch.outputs.branch }}- source_url: ${{ steps.package_branch.outputs.source_url }}tarball_name: ${{ steps.pack.outputs.tarball_name }}source_commit: ${{ steps.package_source.outputs.commit }}source_ref: ${{ steps.package_source.outputs.ref }}@@ -287,8 +315,7 @@ jobs:npm version --no-git-tag-version --allow-same-version "$VERSION"npm cipack_dir="$RUNNER_TEMP/openviking-pack"- package_dir="$RUNNER_TEMP/openviking-package"- mkdir -p "$pack_dir" "$package_dir"+ mkdir -p "$pack_dir"npm pack --pack-destination "$pack_dir"tarball="$(find "$pack_dir" -maxdepth 1 -name '*.tgz' -print -quit)"if [ -z "$tarball" ]; then@@ -297,9 +324,6 @@ jobs:fiecho "tarball_path=$tarball" >> "$GITHUB_OUTPUT"echo "tarball_name=$(basename "$tarball")" >> "$GITHUB_OUTPUT"- tar -xzf "$tarball" -C "$package_dir"- echo "package_dir=$package_dir/package" >> "$GITHUB_OUTPUT"- find "$package_dir/package" -maxdepth 3 -type f | sort- name: Upload npm package tarballuses: actions/upload-artifact@v4@@ -308,33 +332,6 @@ jobs:path: ${{ steps.pack.outputs.tarball_path }}if-no-files-found: error- - name: Push generated package branch- id: package_branch- env:- PACKAGE_DIR: ${{ steps.pack.outputs.package_dir }}- VERSION: ${{ needs.guard.outputs.version }}- BRANCH: clawhub-package-${{ github.run_id }}- SOURCE_REF: ${{ steps.package_source.outputs.ref }}- SOURCE_COMMIT: ${{ steps.package_source.outputs.commit }}- run: |- set -euo pipefail- git config user.name "github-actions[bot]"- git config user.email "41898282+github-actions[bot]@users.noreply.github.com"- git switch --discard-changes --orphan "$BRANCH"- git rm -r --cached . || true- find . -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} +- cp -a "$PACKAGE_DIR"/. .- git add .- git commit \- -m "chore(clawhub): package openviking plugin $VERSION" \- -m "Source ref: $SOURCE_REF" \- -m "Source commit: $SOURCE_COMMIT"- git push --force origin "HEAD:$BRANCH"- source_url="${GITHUB_REPOSITORY}@${BRANCH}"- echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"- echo "source_url=$source_url" >> "$GITHUB_OUTPUT"- echo "source_url=$source_url"-publish-clawhub:name: Publish to ClawHubif: ${{ github.event_name == 'push' || inputs.publish_clawhub }}