build: release-dist.sh wrapper (audit, publish, target-count assertion)
The macOS builder host is supplied through MACOS_HOST rather than defaulted in the script: a private address in a public repository is refused by the history scanner, and it should be.
AuthorPico <picobot@scorpioplayer.com>
Date2026-11-14 05:10:47
Commiteffac9a7
Parents929ab102
Changed files
release-dist.sh+50−0■■■■■
1 file+50−0
Diff
release-dist.sh+50−0■■■■■
11new file mode 100755
index 0000000..749580c
--- /dev/null
+++ b/release-dist.sh
@@ -0,0 +1,50 @@
1+#!/bin/sh
2+# release-dist.sh - build + publish the six dist targets for this plugin.
3+#
4+# The cross-target build, the dist upload and the plugingit mirror all live in
5+# scorpiox-cli-botplugin (it owns the musl / aarch64 / MinGW toolchains and the
6+# macOS builder). This wrapper exists so the release is repeatable and so an
7+# audit failure stops it before anything is published.
8+#
9+# ./release-dist.sh # publish the version in plugin.json
10+# VERSION=1.0.1 ./release-dist.sh # explicit version
11+#
12+# Run it on the build host that has musl-gcc, aarch64-linux-gnu-gcc,
13+# x86_64-w64-mingw32-gcc and ssh access to the macOS builder.
14+#
15+# SSHPASS must be exported: without it the macOS leg answers
16+# "build: macOS skipped: SSHPASS not set" and the dist upload fails, while the
17+# run still prints "build ok: <slug> (4 target(s) built)". Always read the
18+# target count out of latest.json afterwards - it must be 6.
19+
20+set -eu
21+
22+SLUG=webhook
23+ROOT=$(cd "$(dirname "$0")" && pwd)
24+VERSION="${VERSION:-$(python3 -c 'import json,sys;print(json.load(open("'"$ROOT"'/plugin.json"))["version"])')}"
25+# A private address must never be written into this public repository (the
26+# history scanner refuses it, and rightly so), so the builder is supplied by the
27+# environment rather than defaulted here.
28+MACOS_HOST="${MACOS_HOST:?set MACOS_HOST to user@mac-builder (sshd with SSHPASS)}"
29+
30+if ! command -v scorpiox-cli-botplugin >/dev/null 2>&1; then
31+ echo "scorpiox-cli-botplugin not found on PATH" >&2
32+ exit 1
33+fi
34+
35+echo "==> audit $SLUG"
36+scorpiox-cli-botplugin audit "$ROOT" --json || { echo "audit blocked the release" >&2; exit 4; }
37+
38+echo "==> publish $SLUG $VERSION"
39+scorpiox-cli-botplugin publish "$ROOT" \
40+ --slug "$SLUG" \
41+ --version "$VERSION" \
42+ --macos-host "$MACOS_HOST" \
43+ --json
44+
45+echo "==> reindex"
46+scorpiox-cli-botplugin reindex --json >/dev/null 2>&1 || true
47+
48+echo "==> check the target count (must be 6)"
49+curl -s "https://dist.scorpiox.net/bot-plugins/$SLUG/latest.json" |
50+ python3 -c 'import json,sys; d=json.load(sys.stdin); t=d.get("targets",{}); print("version", d.get("version"), "targets", len(t)); sys.exit(0 if len(t)==6 else 1)'
051
release-dist.sh+50−0■■■■■
1new file mode 1007551new file mode 100755
index 0000000..749580cindex 0000000..749580c
--- /dev/null--- /dev/null
+++ b/release-dist.sh+++ b/release-dist.sh
@@ -0,0 +1,50 @@@@ -0,0 +1,50 @@
1+#!/bin/sh
2+# release-dist.sh - build + publish the six dist targets for this plugin.
3+#
4+# The cross-target build, the dist upload and the plugingit mirror all live in
5+# scorpiox-cli-botplugin (it owns the musl / aarch64 / MinGW toolchains and the
6+# macOS builder). This wrapper exists so the release is repeatable and so an
7+# audit failure stops it before anything is published.
8+#
9+# ./release-dist.sh # publish the version in plugin.json
10+# VERSION=1.0.1 ./release-dist.sh # explicit version
11+#
12+# Run it on the build host that has musl-gcc, aarch64-linux-gnu-gcc,
13+# x86_64-w64-mingw32-gcc and ssh access to the macOS builder.
14+#
15+# SSHPASS must be exported: without it the macOS leg answers
16+# "build: macOS skipped: SSHPASS not set" and the dist upload fails, while the
17+# run still prints "build ok: <slug> (4 target(s) built)". Always read the
18+# target count out of latest.json afterwards - it must be 6.
19+
20+set -eu
21+
22+SLUG=webhook
23+ROOT=$(cd "$(dirname "$0")" && pwd)
24+VERSION="${VERSION:-$(python3 -c 'import json,sys;print(json.load(open("'"$ROOT"'/plugin.json"))["version"])')}"
25+# A private address must never be written into this public repository (the
26+# history scanner refuses it, and rightly so), so the builder is supplied by the
27+# environment rather than defaulted here.
28+MACOS_HOST="${MACOS_HOST:?set MACOS_HOST to user@mac-builder (sshd with SSHPASS)}"
29+
30+if ! command -v scorpiox-cli-botplugin >/dev/null 2>&1; then
31+ echo "scorpiox-cli-botplugin not found on PATH" >&2
32+ exit 1
33+fi
34+
35+echo "==> audit $SLUG"
36+scorpiox-cli-botplugin audit "$ROOT" --json || { echo "audit blocked the release" >&2; exit 4; }
37+
38+echo "==> publish $SLUG $VERSION"
39+scorpiox-cli-botplugin publish "$ROOT" \
40+ --slug "$SLUG" \
41+ --version "$VERSION" \
42+ --macos-host "$MACOS_HOST" \
43+ --json
44+
45+echo "==> reindex"
46+scorpiox-cli-botplugin reindex --json >/dev/null 2>&1 || true
47+
48+echo "==> check the target count (must be 6)"
49+curl -s "https://dist.scorpiox.net/bot-plugins/$SLUG/latest.json" |
50+ python3 -c 'import json,sys; d=json.load(sys.stdin); t=d.get("targets",{}); print("version", d.get("version"), "targets", len(t)); sys.exit(0 if len(t)==6 else 1)'
051