fix(release): wait for npm package availability

Wait for newly published CLI versions to become visible before building Docker images. Bound registry probes and the overall wait so npm outages cannot stall release jobs for hours.
This commit is contained in:
digua committed 2026-09-19 09:54:07 +08:00
1 parent 3b44facf87
commit c48d2837f1
1 file changed
+20
+20
View File
@@ -565,6 +565,26 @@ jobs:
packages: write
steps:
- name: Wait for npm package availability
timeout-minutes: 5
shell: bash
env:
CHATLAB_VERSION: ${{ needs.prepare_release.outputs.version }}
run: |
for attempt in {1..30}; do
published_version="$(npm view "chatlab-cli@${CHATLAB_VERSION}" version --registry=https://registry.npmjs.org --prefer-online --fetch-timeout=10000 --fetch-retries=0 2>/dev/null || true)"
if [ "$published_version" = "$CHATLAB_VERSION" ]; then
echo "chatlab-cli@${CHATLAB_VERSION} is available on npm"
exit 0
fi
echo "Waiting for chatlab-cli@${CHATLAB_VERSION} to become available on npm (${attempt}/30)"
sleep 10
done
echo "::error::chatlab-cli@${CHATLAB_VERSION} was not available on npm after 5 minutes"
exit 1
- name: Checkout image definition
uses: actions/checkout@v5