feat: auto-install silencieux des mises à jour (téléchargement + relance auto)
This commit is contained in:
56
tools/release.sh
Executable file
56
tools/release.sh
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# ---------- Token ----------
|
||||
TOKEN="${GITEA_TOKEN:-}"
|
||||
if [ -z "$TOKEN" ] && [ -f ".gitea-token" ]; then
|
||||
TOKEN=$(tr -d '[:space:]' < .gitea-token)
|
||||
fi
|
||||
if [ -z "$TOKEN" ]; then
|
||||
read -rsp "Token Gitea : " TOKEN
|
||||
echo
|
||||
fi
|
||||
|
||||
# ---------- Version ----------
|
||||
CURRENT=$(node -p "require('./package.json').version")
|
||||
if [ -n "${1:-}" ]; then
|
||||
VERSION="$1"
|
||||
else
|
||||
echo "Version actuelle : v$CURRENT"
|
||||
read -rp "Nouvelle version [patch / minor / major / X.Y.Z] : " VERSION
|
||||
fi
|
||||
|
||||
npm version "$VERSION" --no-git-tag-version --silent
|
||||
NEW=$(node -p "require('./package.json').version")
|
||||
echo "→ v$NEW"
|
||||
|
||||
# ---------- Build ----------
|
||||
echo ""
|
||||
echo "Nettoyage des anciens binaires..."
|
||||
find dist -maxdepth 1 \( -name "*.AppImage" -o -name "*.exe" -o -name "*.blockmap" \) -delete 2>/dev/null || true
|
||||
|
||||
echo "Build Linux (AppImage)..."
|
||||
npm run dist --silent
|
||||
|
||||
if command -v wine &>/dev/null; then
|
||||
echo "Build Windows (exe)..."
|
||||
npm run dist:win --silent
|
||||
else
|
||||
echo "(Wine non trouvé — build Windows ignoré)"
|
||||
fi
|
||||
|
||||
# ---------- Release Gitea ----------
|
||||
echo ""
|
||||
GITEA_TOKEN="$TOKEN" node tools/release.js
|
||||
|
||||
# ---------- Git ----------
|
||||
git add package.json package-lock.json
|
||||
git commit -m "chore: release v$NEW" --quiet
|
||||
git remote set-url origin "https://shamiiow:${TOKEN}@git.shamiiow.com/shamiiow/farm-tracker-sao.git"
|
||||
git push --quiet
|
||||
git remote set-url origin "https://git.shamiiow.com/shamiiow/farm-tracker-sao.git"
|
||||
|
||||
echo ""
|
||||
echo "Release v$NEW publiée."
|
||||
Reference in New Issue
Block a user