diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f1ef6165..6a8a4f47 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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