Skip to content

Commit b902946

Browse files
committed
feat: update demo (with latest release) in release script
1 parent 69fb815 commit b902946

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,9 @@ The script:
134134
2. runs the tests and build,
135135
3. bumps the version (updating `package.json` / `package-lock.json`), commits, and tags `vX.Y.Z`,
136136
4. publishes to npm (prompting for your 2FA OTP if enabled),
137-
5. pushes the commit and tag, and
138-
6. creates a GitHub Release with notes generated from the commits/PRs since the previous tag.
137+
5. points the demo at the new release (bumps `docs/` to the just-published version) and commits it,
138+
6. pushes the commits and tag, and
139+
7. creates a GitHub Release with notes generated from the commits/PRs since the previous tag.
139140

140141
If `npm publish` fails, nothing is pushed — the script prints how to undo the local
141142
bump and retry.

scripts/release.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,21 @@ if ! npm publish; then
7777
exit 1
7878
fi
7979

80+
# ── Point the demo at the just-published version ────────────────────────────
81+
# The demo's "vendored release" build (served on GitHub Pages) is regenerated from the published npm package pinned in docs/
82+
newversion="${newtag#v}"
83+
pkg="@raspberrypifoundation/python-friendly-error-messages"
84+
echo "Pointing the demo at $newtag"
85+
if ( cd "$ROOT/docs" && npm pkg set "dependencies.$pkg=^$newversion" && npm install >/dev/null 2>&1 ); then
86+
git add docs/package.json docs/package-lock.json
87+
git commit -m "chore: point demo at $newtag" >/dev/null
88+
else
89+
echo "Warning: couldn't update the demo dependency — the new version may not have" >&2
90+
echo "propagated to npm yet. Once it has, run:" >&2
91+
echo " (cd docs && npm install $pkg@^$newversion) && git commit -am 'chore: point demo at $newtag' && git push" >&2
92+
git checkout -- docs/package.json docs/package-lock.json 2>/dev/null || true
93+
fi
94+
8095
# ── Push + GitHub Release ───────────────────────────────────────────────────
8196
git push --follow-tags origin main
8297

0 commit comments

Comments
 (0)