diff options
Diffstat (limited to '')
| -rwxr-xr-x | scripts/publish.sh | 37 |
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 | ||
| 22 | set -euo pipefail | 21 | set -euo pipefail |
| 23 | 22 | ||
| 24 | ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) | 23 | ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) |
| @@ -31,22 +30,12 @@ if [ -z "${VERSION:-}" ]; then | |||
| 31 | fi | 30 | fi |
| 32 | 31 | ||
| 33 | DEST=${DEST:-web/bin} | 32 | DEST=${DEST:-web/bin} |
| 34 | URL_BASE=${URL_BASE:-https://zagan.2137697.xyz} | ||
| 35 | 33 | ||
| 36 | if [ "${ALLOW_DIRTY:-0}" != "1" ] && [ -n "$(git status --porcelain)" ]; then | 34 | if [ "${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 |
| 39 | fi | 37 | fi |
| 40 | 38 | ||
| 41 | command -v python3 >/dev/null || { | ||
| 42 | echo "python3 is required to render the installers" >&2 | ||
| 43 | exit 1 | ||
| 44 | } | ||
| 45 | |||
| 46 | hash_of() { | ||
| 47 | sha256sum "$1" | awk '{print $1}' | ||
| 48 | } | ||
| 49 | |||
| 50 | publish() { | 39 | publish() { |
| 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 | ||
| 80 | rm web/bin/client/* | ||
| 81 | rm web/bin/gui/* | ||
| 82 | rm web/bin/server/* | ||
| 83 | |||
| 105 | publish_gui x86_64-unknown-linux-gnu linux x86_64 | 84 | publish_gui x86_64-unknown-linux-gnu linux x86_64 |
| 106 | publish_gui x86_64-pc-windows-gnu windows x86_64 | 85 | publish_gui x86_64-pc-windows-gnu windows x86_64 |
| 107 | 86 | ||
