From 082ec80f5652a6db14d22146293578d7405a277a Mon Sep 17 00:00:00 2001 From: mnajafian-nv Date: Mon, 11 May 2026 18:47:48 -0700 Subject: [PATCH] fix: add OpenClaw plugin to npm publishing Signed-off-by: mnajafian-nv --- .github/workflows/ci.yaml | 19 ++++++++++++++- .github/workflows/ci_openclaw.yml | 39 ++++++++++++++++++++++++++++++ integrations/openclaw/package.json | 1 - justfile | 28 +++++++++++++++++++++ 4 files changed, 85 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3097c3a6..2c72855f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -202,6 +202,9 @@ jobs: if: ${{ needs.ci_check.result == 'success' && needs.ci_changes.outputs.run_openclaw == 'true' }} permissions: contents: read + with: + ref_type: ${{ github.ref_type }} + ref_name: ${{ github.ref_name }} ci_python: name: Python @@ -294,7 +297,7 @@ jobs: if [[ "$publish_packages" == "true" ]]; then require_success "Rust" "$RUST_RESULT" require_success "Node.js" "$NODE_RESULT" - allow_success_or_skipped "OpenClaw" "$OPENCLAW_RESULT" + require_success "OpenClaw" "$OPENCLAW_RESULT" require_success "Python" "$PYTHON_RESULT" require_success "WebAssembly" "$WEBASSEMBLY_RESULT" else @@ -439,6 +442,12 @@ jobs: name: wasm-bundler path: wasm-package/ + - name: Download OpenClaw plugin artifact + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: openclaw-npm + path: openclaw-package/ + - name: Select npm dist-tag run: | set -e @@ -456,6 +465,14 @@ jobs: ls -la combined/package/*.node npm publish ./combined/package --access public --tag "${NEMO_FLOW_NPM_DIST_TAG}" + - name: Publish OpenClaw plugin package to npm + run: | + set -euo pipefail + for pkg in ./openclaw-package/*.tgz; do + echo "Publishing ${pkg}..." + npm publish "${pkg}" --access public --tag "${NEMO_FLOW_NPM_DIST_TAG}" + done + - name: Publish WebAssembly package to npm run: | set -e diff --git a/.github/workflows/ci_openclaw.yml b/.github/workflows/ci_openclaw.yml index b20391c2..5af12e35 100644 --- a/.github/workflows/ci_openclaw.yml +++ b/.github/workflows/ci_openclaw.yml @@ -5,6 +5,15 @@ name: OpenClaw on: workflow_call: + inputs: + ref_type: + description: 'The ref type from the triggering workflow' + required: true + type: string + ref_name: + description: 'The ref name from the triggering workflow' + required: true + type: string defaults: run: @@ -14,6 +23,7 @@ env: GH_TOKEN: "${{ github.token }}" GIT_COMMIT: "${{ github.sha }}" NEMO_FLOW_CI_WORKSPACE: "${{ github.workspace }}" + NEMO_FLOW_CI_WORKSPACE_TMP: "${{ github.workspace }}/ci/tmp" UV_PYTHON_DOWNLOADS: never jobs: @@ -56,3 +66,32 @@ jobs: - name: Run OpenClaw integration checks working-directory: ${{ env.NEMO_FLOW_CI_WORKSPACE }} run: just --set ci true test-openclaw + + - name: Derive OpenClaw package version + working-directory: ${{ env.NEMO_FLOW_CI_WORKSPACE }} + run: | + set -e + version="$(node -e 'const fs = require("fs"); const pkg = JSON.parse(fs.readFileSync("integrations/openclaw/package.json", "utf8")); if (!pkg.version) { throw new Error("integrations/openclaw/package.json missing version field"); } console.log(pkg.version);')" + sha="${GITHUB_SHA::8}" + if [ "${{ inputs.ref_type }}" = "tag" ]; then + version="${{ inputs.ref_name }}" + else + version="${version}-${sha}" + fi + printf 'NEMO_FLOW_PACKAGE_VERSION=%s\n' "$version" >> "$GITHUB_ENV" + + - name: Package OpenClaw plugin + working-directory: ${{ env.NEMO_FLOW_CI_WORKSPACE }} + run: | + set -euo pipefail + just \ + --set output_dir "${NEMO_FLOW_CI_WORKSPACE_TMP}" \ + --set ref_name "${NEMO_FLOW_PACKAGE_VERSION}" \ + package-openclaw + + - name: Upload OpenClaw plugin artifact + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: openclaw-npm + path: ${{ env.NEMO_FLOW_CI_WORKSPACE_TMP }}/openclaw/*.tgz + if-no-files-found: error diff --git a/integrations/openclaw/package.json b/integrations/openclaw/package.json index 158a31ef..f4254978 100644 --- a/integrations/openclaw/package.json +++ b/integrations/openclaw/package.json @@ -1,7 +1,6 @@ { "name": "nemo-flow-openclaw", "version": "0.2.0", - "private": true, "description": "NeMo Flow-authored observability plugin for OpenClaw.", "type": "module", "main": "./dist/index.js", diff --git a/justfile b/justfile index f635d8e2..78d05ee7 100644 --- a/justfile +++ b/justfile @@ -898,6 +898,7 @@ test-openclaw: fi npm run typecheck --workspace=nemo-flow-openclaw npm test --workspace=nemo-flow-openclaw + npm run pack:check --workspace=nemo-flow-openclaw # --set [output_dir=] [ci=true|false] test-wasm: @@ -993,6 +994,33 @@ package-node: exit 1 fi +# --set [output_dir=] [ref_name=] +package-openclaw: + #!/usr/bin/env bash + {{ bash_helpers }} + # If `ref_name` is empty, append the current short HEAD SHA to the version. + # If `ref_name` is set, write it as the exact package version before packing. + output_dir="{{ output_dir }}" + cd "$NEMO_FLOW_REPO_ROOT" + package_dir="$(prepare_package_dir openclaw)" + if [[ -z "{{ ref_name }}" ]]; then + sha="$(head_git_sha)" + version="$(read_npm_package_version integrations/openclaw/package.json)" + echo "Non-release build: appending commit hash to version" + set_npm_package_version integrations/openclaw/package.json package-lock.json "${version}-${sha}" integrations/openclaw + else + echo "Using explicit version {{ ref_name }}" + set_npm_package_version integrations/openclaw/package.json package-lock.json "{{ ref_name }}" integrations/openclaw + fi + npm install --workspace=nemo-flow-openclaw --ignore-scripts + npm pack --workspace=nemo-flow-openclaw --pack-destination "$package_dir" + shopt -s nullglob + packages=("$package_dir"/*.tgz) + if ((${#packages[@]} == 0)); then + echo "Error: No OpenClaw npm packages found in $package_dir" + exit 1 + fi + # --set [output_dir=] [ref_name=] package-python: #!/usr/bin/env bash