Files
MrTerm/scripts/release-all.sh
T

42 lines
1.8 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
# Fragt nach der Version, baut Windows (Setup + Portable, per wine), Arch/CachyOS (pacman + AppImage)
# und Android (APK, signiert mit mobile/android/keystore.properties) und lädt alles als Release v<version> nach Gitea hoch.
# Token: Umgebungsvariable GITEA_TOKEN oder Datei .gitea-token im Projektordner (nicht eingecheckt).
set -euo pipefail
cd "$(dirname "$0")/.."
unset ELECTRON_RUN_AS_NODE
if [[ -z "${GITEA_TOKEN:-}" && -f .gitea-token ]]; then GITEA_TOKEN="$(tr -d '[:space:]' < .gitea-token)"; fi
if [[ -z "${GITEA_TOKEN:-}" ]]; then read -rsp "Gitea-Token: " GITEA_TOKEN; echo; fi
export GITEA_TOKEN
current="$(node -p "require('./package.json').version")"
read -rp "Release-Version [${current}]: " version
version="${version:-$current}"
version="${version#v}"
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$ ]] || { echo "Ungültige Version: $version"; exit 1; }
read -rp "Release-Notizen: " notes
prerelease=()
[[ "$version" == *-* ]] && prerelease=(--prerelease)
if [[ "$version" != "$current" ]]; then
npm version "$version" --no-git-tag-version >/dev/null
git add package.json package-lock.json
git commit -m "Version ${version}"
fi
# Push mit dem Gitea-Token (Basic-Auth, Benutzer aus GITEA_USER, Standard MrBlake)
auth="$(printf '%s:%s' "${GITEA_USER:-MrBlake}" "$GITEA_TOKEN" | base64 -w0)"
git -c http.extraHeader="Authorization: Basic ${auth}" push origin HEAD
rm -rf dist
npm run dist:linux
npm run dist:win
if [[ -f mobile/android/keystore.properties ]]; then
[[ -d mobile/node_modules/capacitor-nodejs ]] || (cd mobile && node build.js --setup)
(cd mobile && node build.js --apk)
else
echo "mobile/android/keystore.properties fehlt – Android-APK wird übersprungen"
fi
npm run release -- --notes "$notes" "${prerelease[@]}"