#!/usr/bin/env bash # Baut die Binaries (deploy/build.sh) und lädt sie per rsync auf den statischen # Webhost (z. B. inst.chmln.de): # # TARGET=deploy@webdocker11:/srv/inst/htdocs deploy/publish-static.sh # STABLE=1 TARGET=… deploy/publish-static.sh # zusätzlich als "stable" markieren # # Ablage unter ${TARGET}/sultan/: # releases//sultan_linux_{amd64,arm64} # releases//SHA256SUMS # releases/stable → enthält die stabile Version (nur mit STABLE=1) # # Ältere Versionen bleiben liegen und damit herunterladbar. set -euo pipefail cd "$(dirname "$0")/.." : "${TARGET:?TARGET setzen, z. B. TARGET=deploy@webdocker11:/srv/inst/htdocs}" VERSION="${VERSION:-$(git describe --tags --always --dirty)}" export VERSION case "$VERSION" in *-dirty) echo "Arbeitsverzeichnis hat uncommittete Änderungen (${VERSION}) – erst committen." >&2 exit 1 ;; esac deploy/build.sh stage="$(mktemp -d)" trap 'rm -rf "$stage"' EXIT mkdir -p "${stage}/sultan/releases/${VERSION}" cp "dist/${VERSION}"/* "${stage}/sultan/releases/${VERSION}/" if [ "${STABLE:-0}" = 1 ]; then echo "$VERSION" > "${stage}/sultan/releases/stable" fi chmod -R a+rX "$stage" # Ohne --delete: bereits veröffentlichte Versionen bleiben erhalten. rsync -rlv --chmod=Da+rx,Fa+r "${stage}/" "${TARGET}/" echo "==> veröffentlicht: sultan/releases/${VERSION}"