3232 CLAWHUB_REGISTRY : " https://clawhub.ai"
3333 CLAWHUB_REPOSITORY : " openclaw/clawhub"
3434 # Pinned to a reviewed ClawHub commit so release behavior stays reproducible.
35- CLAWHUB_REF : " 199e6a0cdf32471702e0503e9899e8d24f06a527 "
35+ CLAWHUB_REF : " facf20ceb6cc459e2872d941e71335a784bbc55c "
3636
3737jobs :
3838 preview_plugins_clawhub :
5050 uses : actions/checkout@v6
5151 with :
5252 persist-credentials : false
53- ref : ${{ github.event_name == 'workflow_dispatch' && inputs. ref || github.sha }}
53+ ref : ${{ github.ref }}
5454 fetch-depth : 0
5555
5656 - name : Setup Node environment
@@ -62,14 +62,29 @@ jobs:
6262
6363 - name : Resolve checked-out ref
6464 id : ref
65- run : echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
66-
67- - name : Validate ref is on main or a release branch
65+ env :
66+ TARGET_REF : ${{ github.event_name == 'workflow_dispatch' && inputs.ref || '' }}
6867 run : |
6968 set -euo pipefail
7069 git fetch --no-tags origin \
7170 +refs/heads/main:refs/remotes/origin/main \
7271 '+refs/heads/release/*:refs/remotes/origin/release/*'
72+ if [[ -n "${TARGET_REF}" ]]; then
73+ if git rev-parse --verify --quiet "${TARGET_REF}^{commit}" >/dev/null; then
74+ target_sha="$(git rev-parse "${TARGET_REF}^{commit}")"
75+ elif git rev-parse --verify --quiet "origin/${TARGET_REF}^{commit}" >/dev/null; then
76+ target_sha="$(git rev-parse "origin/${TARGET_REF}^{commit}")"
77+ else
78+ echo "Unable to resolve requested publish ref: ${TARGET_REF}" >&2
79+ exit 1
80+ fi
81+ git checkout --detach "${target_sha}"
82+ fi
83+ echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
84+
85+ - name : Validate ref is on main or a release branch
86+ run : |
87+ set -euo pipefail
7388 if git merge-base --is-ancestor HEAD origin/main; then
7489 exit 0
7590 fi
@@ -153,6 +168,12 @@ jobs:
153168 echo "::error::One or more selected plugin versions already exist on ClawHub. Bump the version before running a real publish."
154169 exit 1
155170
171+ - name : Verify OpenClaw ClawHub package ownership
172+ if : steps.plan.outputs.has_candidates == 'true'
173+ env :
174+ CLAWHUB_REGISTRY : ${{ env.CLAWHUB_REGISTRY }}
175+ run : node --import tsx scripts/plugin-clawhub-owner-preflight.ts .local/plugin-clawhub-release-plan.json
176+
156177 preview_plugin_pack :
157178 needs : preview_plugins_clawhub
158179 if : needs.preview_plugins_clawhub.outputs.has_candidates == 'true'
@@ -161,16 +182,26 @@ jobs:
161182 contents : read
162183 strategy :
163184 fail-fast : false
164- max-parallel : 1
185+ max-parallel : 6
165186 matrix :
166187 plugin : ${{ fromJson(needs.preview_plugins_clawhub.outputs.matrix) }}
167188 steps :
168189 - name : Checkout
169190 uses : actions/checkout@v6
170191 with :
171192 persist-credentials : false
172- ref : ${{ needs.preview_plugins_clawhub.outputs.ref_revision }}
173- fetch-depth : 1
193+ ref : ${{ github.ref }}
194+ fetch-depth : 0
195+
196+ - name : Checkout target revision
197+ env :
198+ TARGET_SHA : ${{ needs.preview_plugins_clawhub.outputs.ref_revision }}
199+ run : |
200+ set -euo pipefail
201+ git fetch --no-tags origin \
202+ +refs/heads/main:refs/remotes/origin/main \
203+ '+refs/heads/release/*:refs/remotes/origin/release/*'
204+ git checkout --detach "${TARGET_SHA}"
174205
175206 - name : Setup Node environment
176207 uses : ./.github/actions/setup-node-env
@@ -185,9 +216,15 @@ jobs:
185216 with :
186217 persist-credentials : false
187218 repository : ${{ env.CLAWHUB_REPOSITORY }}
188- ref : ${{ env.CLAWHUB_REF }}
219+ ref : main
189220 path : clawhub-source
190- fetch-depth : 1
221+ fetch-depth : 0
222+
223+ - name : Checkout pinned ClawHub CLI revision
224+ working-directory : clawhub-source
225+ env :
226+ CLAWHUB_REF : ${{ env.CLAWHUB_REF }}
227+ run : git checkout --detach "${CLAWHUB_REF}"
191228
192229 - name : Install ClawHub CLI dependencies
193230 working-directory : clawhub-source
@@ -203,6 +240,9 @@ jobs:
203240 chmod +x "$RUNNER_TEMP/clawhub"
204241 echo "$RUNNER_TEMP" >> "$GITHUB_PATH"
205242
243+ - name : Verify package-local runtime build
244+ run : pnpm release:plugins:npm:runtime:check --package "${{ matrix.plugin.packageDir }}"
245+
206246 - name : Preview publish command
207247 env :
208248 CLAWHUB_REGISTRY : ${{ env.CLAWHUB_REGISTRY }}
@@ -223,15 +263,26 @@ jobs:
223263 id-token : write
224264 strategy :
225265 fail-fast : false
266+ max-parallel : 6
226267 matrix :
227268 plugin : ${{ fromJson(needs.preview_plugins_clawhub.outputs.matrix) }}
228269 steps :
229270 - name : Checkout
230271 uses : actions/checkout@v6
231272 with :
232273 persist-credentials : false
233- ref : ${{ needs.preview_plugins_clawhub.outputs.ref_revision }}
234- fetch-depth : 1
274+ ref : ${{ github.ref }}
275+ fetch-depth : 0
276+
277+ - name : Checkout target revision
278+ env :
279+ TARGET_SHA : ${{ needs.preview_plugins_clawhub.outputs.ref_revision }}
280+ run : |
281+ set -euo pipefail
282+ git fetch --no-tags origin \
283+ +refs/heads/main:refs/remotes/origin/main \
284+ '+refs/heads/release/*:refs/remotes/origin/release/*'
285+ git checkout --detach "${TARGET_SHA}"
235286
236287 - name : Setup Node environment
237288 uses : ./.github/actions/setup-node-env
@@ -246,9 +297,15 @@ jobs:
246297 with :
247298 persist-credentials : false
248299 repository : ${{ env.CLAWHUB_REPOSITORY }}
249- ref : ${{ env.CLAWHUB_REF }}
300+ ref : main
250301 path : clawhub-source
251- fetch-depth : 1
302+ fetch-depth : 0
303+
304+ - name : Checkout pinned ClawHub CLI revision
305+ working-directory : clawhub-source
306+ env :
307+ CLAWHUB_REF : ${{ env.CLAWHUB_REF }}
308+ run : git checkout --detach "${CLAWHUB_REF}"
252309
253310 - name : Install ClawHub CLI dependencies
254311 working-directory : clawhub-source
@@ -304,7 +361,19 @@ jobs:
304361 encoded_name="$(node -e 'console.log(encodeURIComponent(process.env.PACKAGE_NAME ?? ""))')"
305362 encoded_version="$(node -e 'console.log(encodeURIComponent(process.env.PACKAGE_VERSION ?? ""))')"
306363 url="${CLAWHUB_REGISTRY%/}/api/v1/packages/${encoded_name}/versions/${encoded_version}"
307- status="$(curl --silent --show-error --output /dev/null --write-out '%{http_code}' "${url}")"
364+ status=""
365+ for attempt in $(seq 1 8); do
366+ status="$(curl --silent --show-error --output /dev/null --write-out '%{http_code}' "${url}")"
367+ if [[ "${status}" == "404" || "${status}" =~ ^2 ]]; then
368+ break
369+ fi
370+ if [[ "${status}" == "429" || "${status}" =~ ^5 ]]; then
371+ echo "ClawHub availability check returned ${status} for ${PACKAGE_NAME}@${PACKAGE_VERSION}; retrying (${attempt}/8)."
372+ sleep 60
373+ continue
374+ fi
375+ break
376+ done
308377 if [[ "${status}" =~ ^2 ]]; then
309378 echo "${PACKAGE_NAME}@${PACKAGE_VERSION} is already published on ClawHub."
310379 exit 1
0 commit comments