build: wait for npm to serve a released version
npm answers with a placeholder version (0.0.0-stage) for about four minutes after `npm publish`. The first release ended the script in that window: a fresh install got the placeholder and loaded no extension, and the pi.dev/packages gallery returned 404. Poll the registry until the released version resolves, for at most ten minutes, so the script's exit means `pi install` works. Observed with pi-nous-portal 0.1.0, which became installable at 15:19:25 UTC and listed 8 models from a fresh agent dir.
This commit is contained in:
1 parent
e534b27f94
commit
21ec8029c5
4 files changed
+18
-2
No files matched your search
+12
@@ -19,6 +19,7 @@ if [ -n "$bump" ]; then
|
||||
npm version "$bump" --no-git-tag-version
|
||||
fi
|
||||
version=$(node -p "require('./package.json').version")
|
||||
name=$(node -p "require('./package.json').name")
|
||||
|
||||
grep -qx '## \[Unreleased\]' CHANGELOG.md || { echo "CHANGELOG.md has no '## [Unreleased]' heading" >&2; exit 1; }
|
||||
|
||||
@@ -32,3 +33,14 @@ git commit -am "release v$version"
|
||||
git tag -a "v$version" -m "v$version"
|
||||
npm publish
|
||||
git push origin main --follow-tags
|
||||
|
||||
# npm answers with a placeholder for a few minutes before the version resolves.
|
||||
tries=0
|
||||
until [ "$(npm view "$name@$version" version 2>/dev/null | tr -d "[:space:]'")" = "$version" ]; do
|
||||
tries=$((tries + 1))
|
||||
if [ "$tries" -ge 40 ]; then
|
||||
echo "npm still has not served $name@$version after 10 minutes. Check https://www.npmjs.com/package/$name" >&2
|
||||
break
|
||||
fi
|
||||
sleep 15
|
||||
done
|
||||
Reference in new issue
Block a user