summaryrefslogtreecommitdiffstats
path: root/scripts/publish.sh
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-01 21:35:30 +0100
committersalmonik <salmonik@tuta.io>2026-11-01 21:38:36 +0100
commit7830b3c5e89f0339949940b8986bf4849ad7f223 (patch)
treed4ebb4f10583cef1da3b181e093dd5d65ac8a0bb /scripts/publish.sh
parentv4.2.1: plain-language game copy and a balance fetch on login (diff)
downloadzagan-bet-7830b3c5e89f0339949940b8986bf4849ad7f223.tar.gz
zagan-bet-7830b3c5e89f0339949940b8986bf4849ad7f223.zip
v4.3.0: package the desktop app with verifiable installers
publish.sh builds the GUI with the gui-release profile, names it zagan-bet-gui-<version>-<platform>-<arch>, and renders a bash and a PowerShell installer next to each app. Both embed the app's SHA-256, verify the file (or fetch it), install per-user and add a launcher: a desktop entry plus an SVG icon on Linux, a Start-menu shortcut on Windows. The download page gains a Desktop app section with the apps and installers, keeps the terminal client and server, links the public git repository for the GPL source, and lists every file in the sha256sum block. deploy.sh verifies all four artifact kinds. Publishing refuses a dirty tree so the linked history matches the binaries.
Diffstat (limited to '')
-rwxr-xr-xscripts/publish.sh66
1 files changed, 62 insertions, 4 deletions
diff --git a/scripts/publish.sh b/scripts/publish.sh
index 8240859..3a04631 100755
--- a/scripts/publish.sh
+++ b/scripts/publish.sh
@@ -3,14 +3,22 @@
3# download page expects: 3# download page expects:
4# 4#
5# zagan-bet-client-<version>-<platform>-<arch>[.exe] 5# zagan-bet-client-<version>-<platform>-<arch>[.exe]
6# zagan-bet-server-<version>-<platform>-<arch> 6# zagan-bet-server-<version>-<platform>-<arch>[.exe]
7# zagan-bet-gui-<version>-<platform>-<arch>[.exe]
8# zagan-bet-gui-<version>-<platform>-<arch>-install.sh
9# zagan-bet-gui-<version>-<platform>-<arch>-install.ps1
7# 10#
8# Cargo always writes target/<triple>/release/<bin>, so the rename happens here 11# Cargo always writes target/<triple>/<profile>/<bin>, so the rename happens
9# after each build. The version comes from Cargo.toml. 12# here after each build. The version comes from Cargo.toml.
13#
14# The GUI uses the workspace's `gui-release` profile (small, stripped, LTO).
15# The public git repository is the GPL source for these binaries, so publish
16# from a clean tree (or set ALLOW_DIRTY=1 for a preview).
10# 17#
11# Usage: 18# Usage:
12# ./scripts/publish.sh 19# ./scripts/publish.sh
13# DEST=/srv/www/bin ./scripts/publish.sh 20# DEST=/srv/www/bin ./scripts/publish.sh
21# URL_BASE=https://staging.example/ ./scripts/publish.sh
14set -euo pipefail 22set -euo pipefail
15 23
16ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) 24ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
@@ -23,6 +31,21 @@ if [ -z "${VERSION:-}" ]; then
23fi 31fi
24 32
25DEST=${DEST:-web/bin} 33DEST=${DEST:-web/bin}
34URL_BASE=${URL_BASE:-https://zagan.2137697.xyz}
35
36if [ "${ALLOW_DIRTY:-0}" != "1" ] && [ -n "$(git status --porcelain)" ]; then
37 echo "the working tree is dirty; commit the release first (or ALLOW_DIRTY=1)" >&2
38 exit 1
39fi
40
41command -v python3 >/dev/null || {
42 echo "python3 is required to render the installers" >&2
43 exit 1
44}
45
46hash_of() {
47 sha256sum "$1" | awk '{print $1}'
48}
26 49
27publish() { 50publish() {
28 local triple=$1 kind=$2 platform=$3 arch=$4 51 local triple=$1 kind=$2 platform=$3 arch=$4
@@ -47,11 +70,46 @@ publish() {
47 echo " $DEST/$kind/$artifact ($(du -h "$DEST/$kind/$artifact" | cut -f1))" 70 echo " $DEST/$kind/$artifact ($(du -h "$DEST/$kind/$artifact" | cut -f1))"
48} 71}
49 72
73publish_gui() {
74 local triple=$1 platform=$2 arch=$3
75 local ext=""
76 if [ "$platform" = windows ]; then
77 ext=".exe"
78 fi
79
80 local artifact="zagan-bet-gui-$VERSION-$platform-$arch$ext"
81 local source="target/$triple/gui-release/zagan-bet-gui$ext"
82
83 echo "==> $artifact"
84 cargo build -p zagan-bet-gui --profile gui-release --quiet --target "$triple"
85
86 mkdir -p "$DEST/gui"
87 install -m 0755 "$source" "$DEST/gui/$artifact"
88 local sha
89 sha=$(hash_of "$DEST/gui/$artifact")
90 echo " $DEST/gui/$artifact ($(du -h "$DEST/gui/$artifact" | cut -f1))"
91
92 if [ "$platform" = linux ]; then
93 python3 scripts/render-installer.py \
94 scripts/installers/linux.sh.in \
95 "$DEST/gui/zagan-bet-gui-$VERSION-linux-$arch-install.sh" \
96 "$VERSION" "$artifact" "$sha" "$URL_BASE/bin/gui/$artifact"
97 elif [ "$platform" = windows ]; then
98 python3 scripts/render-installer.py \
99 scripts/installers/windows.ps1.in \
100 "$DEST/gui/zagan-bet-gui-$VERSION-windows-$arch-install.ps1" \
101 "$VERSION" "$artifact" "$sha" "$URL_BASE/bin/gui/$artifact"
102 fi
103}
104
105publish_gui x86_64-unknown-linux-gnu linux x86_64
106publish_gui x86_64-pc-windows-gnu windows x86_64
107
50publish x86_64-unknown-linux-gnu client linux x86_64 108publish x86_64-unknown-linux-gnu client linux x86_64
51publish i686-unknown-linux-gnu client linux i686 109publish i686-unknown-linux-gnu client linux i686
52publish x86_64-pc-windows-gnu client windows x86_64 110publish x86_64-pc-windows-gnu client windows x86_64
53publish x86_64-unknown-linux-gnu server linux x86_64 111publish x86_64-unknown-linux-gnu server linux x86_64
54publish x86_64-pc-windows-gnu server windows x86_64 112publish x86_64-pc-windows-gnu server windows x86_64
55 113
56echo 114echo
57echo "published $VERSION to $DEST" 115echo "published $VERSION to $DEST"