summaryrefslogtreecommitdiffstats
path: root/scripts/publish.sh
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-01 22:23:00 +0100
committersalmonik <salmonik@tuta.io>2026-11-01 22:23:00 +0100
commit4887abc5773b33ab1e213ed5f528dfebd242e2cd (patch)
tree8eb2316783a21817cce422c3fb58ec953206dd9a /scripts/publish.sh
parentv4.3.1: render Windows through wgpu and keep the installer window open (diff)
downloadzagan-bet-4887abc5773b33ab1e213ed5f528dfebd242e2cd.tar.gz
zagan-bet-4887abc5773b33ab1e213ed5f528dfebd242e2cd.zip
v4.4.0: stable installers that follow the newest published buildHEADmaster
Adds web/latest.php: a plain-text feed of the newest version with each artifact's filename and SHA-256. The per-release generated installers are replaced by stable web/install.sh and web/install.ps1; both read the feed, pick the newest build, verify it, install per-user and add a launcher. Publishing a new app version no longer regenerates or versions the installers. publish.sh drops the installer renderer and Python dependency. deploy.sh now also verifies latest.php against the local artifacts and that the served installer scripts match the repository.
Diffstat (limited to 'scripts/publish.sh')
-rwxr-xr-xscripts/publish.sh37
1 files changed, 8 insertions, 29 deletions
diff --git a/scripts/publish.sh b/scripts/publish.sh
index 3a04631..fbcd588 100755
--- a/scripts/publish.sh
+++ b/scripts/publish.sh
@@ -5,20 +5,19 @@
5# zagan-bet-client-<version>-<platform>-<arch>[.exe] 5# zagan-bet-client-<version>-<platform>-<arch>[.exe]
6# zagan-bet-server-<version>-<platform>-<arch>[.exe] 6# zagan-bet-server-<version>-<platform>-<arch>[.exe]
7# zagan-bet-gui-<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
10# 8#
11# Cargo always writes target/<triple>/<profile>/<bin>, so the rename happens 9# Cargo always writes target/<triple>/<profile>/<bin>, so the rename happens
12# here after each build. The version comes from Cargo.toml. 10# here after each build. The version comes from Cargo.toml.
13# 11#
14# The GUI uses the workspace's `gui-release` profile (small, stripped, LTO). 12# 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 13# The installers are stable site files (web/install.sh and web/install.ps1):
16# from a clean tree (or set ALLOW_DIRTY=1 for a preview). 14# they ask web/latest.php for the newest build, so they are not regenerated
15# here. The public git repository is the GPL source for these binaries, so
16# publish from a clean tree (or set ALLOW_DIRTY=1 for a preview).
17# 17#
18# Usage: 18# Usage:
19# ./scripts/publish.sh 19# ./scripts/publish.sh
20# DEST=/srv/www/bin ./scripts/publish.sh 20# DEST=/srv/www/bin ./scripts/publish.sh
21# URL_BASE=https://staging.example/ ./scripts/publish.sh
22set -euo pipefail 21set -euo pipefail
23 22
24ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) 23ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
@@ -31,22 +30,12 @@ if [ -z "${VERSION:-}" ]; then
31fi 30fi
32 31
33DEST=${DEST:-web/bin} 32DEST=${DEST:-web/bin}
34URL_BASE=${URL_BASE:-https://zagan.2137697.xyz}
35 33
36if [ "${ALLOW_DIRTY:-0}" != "1" ] && [ -n "$(git status --porcelain)" ]; then 34if [ "${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 35 echo "the working tree is dirty; commit the release first (or ALLOW_DIRTY=1)" >&2
38 exit 1 36 exit 1
39fi 37fi
40 38
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}
49
50publish() { 39publish() {
51 local triple=$1 kind=$2 platform=$3 arch=$4 40 local triple=$1 kind=$2 platform=$3 arch=$4
52 local ext="" 41 local ext=""
@@ -85,23 +74,13 @@ publish_gui() {
85 74
86 mkdir -p "$DEST/gui" 75 mkdir -p "$DEST/gui"
87 install -m 0755 "$source" "$DEST/gui/$artifact" 76 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))" 77 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} 78}
104 79
80rm web/bin/client/*
81rm web/bin/gui/*
82rm web/bin/server/*
83
105publish_gui x86_64-unknown-linux-gnu linux x86_64 84publish_gui x86_64-unknown-linux-gnu linux x86_64
106publish_gui x86_64-pc-windows-gnu windows x86_64 85publish_gui x86_64-pc-windows-gnu windows x86_64
107 86