Files
sultan/deploy/publish-static.sh
br ca6cdcca63 software steht so weit.
jetzt build + docker build und testen
2026-10-02 13:25:34 +02:00

43 lines
1.3 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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/<version>/sultan_linux_{amd64,arm64}
# releases/<version>/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}"