Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ This runs `build.sh`, produces `dist/webdecoy-<version>.zip`, and regenerates
rejects a package whose hash doesn't match). `cdn-files/update-info.json` is
git-ignored on purpose — it's a per-build artifact, uploaded to the CDN rather
than committed. `cdn-files/plugin-info.json` (the "View details" metadata) is
tracked; bump its `version`/`download_url`/changelog when they change.
tracked; bump its `version`, `download_url` and changelog with every release.
`bin/release-all.sh` refuses to publish until it names the release, then
uploads it with the zip and manifest and checks what the CDN serves.

## 3. Upload to the CDN

Expand Down
17 changes: 17 additions & 0 deletions bin/release-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@ MANIFEST_VER="$(python3 -c "import json;print(json.load(open('cdn-files/update-i
[ "${MANIFEST_VER}" = "${VERSION}" ] || die "update-info.json says version ${MANIFEST_VER}, expected ${VERSION}"
ok "zip and manifest agree on ${ZIP_SHA}"

# plugin-info.json is the "View details" panel self-hosted installs read. It is
# tracked and edited by hand, so check it names this release before anything is
# uploaded; it used to be left out of the upload entirely and went stale.
INFO_VER="$(python3 -c "import json;print(json.load(open('cdn-files/plugin-info.json'))['version'])")"
INFO_URL="$(python3 -c "import json;print(json.load(open('cdn-files/plugin-info.json'))['download_url'])")"
[ "${INFO_VER}" = "${VERSION}" ] || die "cdn-files/plugin-info.json says version ${INFO_VER}, expected ${VERSION} — bump it first"
[ "${INFO_URL}" = "${CDN_BASE}/${SLUG}-${VERSION}.zip" ] \
|| die "cdn-files/plugin-info.json download_url is ${INFO_URL}, expected ${CDN_BASE}/${SLUG}-${VERSION}.zip"
ok "plugin-info.json names ${VERSION}"

if [ "${DO_PUBLISH}" = "1" ]; then
say "Publishing to R2"
# Zip BEFORE manifest: a manifest naming a zip that is not there yet breaks every
Expand All @@ -118,6 +128,10 @@ if [ "${DO_PUBLISH}" = "1" ]; then
npx wrangler r2 object put "${R2_BUCKET}/wordpress/update-info.json" \
--file=./cdn-files/update-info.json --remote >/dev/null 2>&1 || die "R2 upload of the manifest failed"
ok "uploaded update-info.json"
npx wrangler r2 object put "${R2_BUCKET}/wordpress/plugin-info.json" \
--file=./cdn-files/plugin-info.json --content-type application/json --remote >/dev/null 2>&1 \
|| die "R2 upload of plugin-info.json failed"
ok "uploaded plugin-info.json"

say "Verifying what the CDN actually serves"
served="$(curl -fsS "${CDN_BASE}/${SLUG}-${VERSION}.zip" | shasum -a 256 | cut -d' ' -f1)" \
Expand All @@ -127,6 +141,9 @@ if [ "${DO_PUBLISH}" = "1" ]; then
served_ver="$(curl -fsS "${CDN_BASE}/update-info.json" | python3 -c "import json,sys;print(json.load(sys.stdin)['version'])")"
[ "${served_ver}" = "${VERSION}" ] || die "CDN manifest says ${served_ver}"
ok "CDN manifest says ${VERSION}"
served_info="$(curl -fsS "${CDN_BASE}/plugin-info.json?v=${VERSION}" | python3 -c "import json,sys;print(json.load(sys.stdin)['version'])")"
[ "${served_info}" = "${VERSION}" ] || die "CDN plugin-info.json says ${served_info}"
ok "CDN plugin-info.json says ${VERSION}"
else
ok "dry run — nothing uploaded to R2"
fi
Expand Down
Loading