From 816c4259d0de71c07a0fb89d1449eb364f3bc1a9 Mon Sep 17 00:00:00 2001 From: Howard Askew <19271569+howaskew@users.noreply.github.com> Date: Thu, 29 Oct 2026 10:40:35 +0000 Subject: [PATCH] ci: Wait for npm before dispatching, and skip releases for workflow-only changes npm can take several minutes to make a new version available (models-ts 1.0.8 took 12 minutes). The dispatched repositories install @latest straight away, so they could pick up the previous version. Wait until the new version can be fetched before dispatching, as data-models does. A merge that only changes files under .github does not change the package, so the publish workflow no longer runs for it. Pull request checks are unaffected. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/publish-to-npm.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/publish-to-npm.yaml b/.github/workflows/publish-to-npm.yaml index bba0bfa..f4dcf6d 100644 --- a/.github/workflows/publish-to-npm.yaml +++ b/.github/workflows/publish-to-npm.yaml @@ -3,6 +3,9 @@ name: Publish to npm on: push: branches: [ master ] + # A merge that only changes workflows does not change the package, so it is not released + paths-ignore: + - '.github/**' # Never run two publishes at once; a second merge waits for the first to finish concurrency: @@ -51,6 +54,21 @@ jobs: run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN2 }} + # npm may take several minutes to make a new version available; downstream repositories install @latest + # as soon as they are dispatched, so wait until the new version can be fetched before dispatching + - name: Wait for the new version on npm + run: | + version=$(node -p "require('./package.json').version") + for i in $(seq 1 60); do + if curl -sf -o /dev/null "https://registry.npmjs.org/@openactive%2fdata-model-validator/$version?nocache=$(date +%s)"; then + echo "$version is available on npm" + exit 0 + fi + echo "Attempt $i: $version not yet available, waiting" + sleep 30 + done + echo "$version was not available on npm within 30 minutes" + exit 1 dispatch: needs: publish