Actualiser Scripts
128
Scripts.md
128
Scripts.md
@@ -1,51 +1,87 @@
|
|||||||
# Scripts de release — Paycheck
|
# Script Debian (zsh) — scripts/release.sh
|
||||||
|
|
||||||
Ces scripts permettent de générer des binaires fiables et reproductibles pour chaque release de Paycheck.
|
```
|
||||||
|
#!/bin/zsh
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
Principe clé :
|
# Paycheck release helper (Linux)
|
||||||
Une release correspond toujours à un tag Git au format vX.Y.Z.
|
# - Requires: git, node/npm, wails, zip
|
||||||
Les scripts refusent de s’exécuter si le dépôt n’est pas propre ou si HEAD n’est pas positionné exactement sur un tag.
|
# - Enforces: exact tag checkout (vX.Y.Z)
|
||||||
|
|
||||||
|
APP="paycheck"
|
||||||
|
ARCH="amd64"
|
||||||
|
PLATFORM="linux"
|
||||||
|
|
||||||
|
echo "== Paycheck Linux release =="
|
||||||
|
|
||||||
|
# Ensure we're in repo root (contains wails.json)
|
||||||
|
if [[ ! -f "wails.json" ]]; then
|
||||||
|
echo "ERROR: wails.json not found. Run this script from the repo root."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ensure clean working tree
|
||||||
|
if [[ -n "$(git status --porcelain)" ]]; then
|
||||||
|
echo "ERROR: Working tree is not clean. Commit/stash changes before releasing."
|
||||||
|
git status --porcelain
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ensure we are exactly on a tag vX.Y.Z
|
||||||
|
TAG="$(git describe --tags --exact-match 2>/dev/null || true)"
|
||||||
|
if [[ -z "$TAG" ]]; then
|
||||||
|
echo "ERROR: You are not on an exact tag."
|
||||||
|
echo "Hint: git fetch --tags && git checkout vX.Y.Z"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ ! "$TAG" =~ '^v[0-9]+\.[0-9]+\.[0-9]+$' ]]; then
|
||||||
|
echo "ERROR: Tag '$TAG' does not match SemVer format vX.Y.Z"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Tag: $TAG"
|
||||||
|
echo "Commit: $(git rev-parse HEAD)"
|
||||||
|
|
||||||
|
# Frontend install/build (clean, reproducible)
|
||||||
|
echo "== Frontend =="
|
||||||
|
pushd frontend >/dev/null
|
||||||
|
if [[ -f package-lock.json ]]; then
|
||||||
|
npm ci
|
||||||
|
else
|
||||||
|
npm install
|
||||||
|
fi
|
||||||
|
npm run build
|
||||||
|
popd >/dev/null
|
||||||
|
|
||||||
|
# Build
|
||||||
|
echo "== Wails build =="
|
||||||
|
rm -rf build/bin || true
|
||||||
|
wails build
|
||||||
|
|
||||||
|
OUTDIR="build/bin"
|
||||||
|
SRC="$OUTDIR/$APP"
|
||||||
|
if [[ ! -f "$SRC" ]]; then
|
||||||
|
echo "ERROR: Expected binary not found at $SRC"
|
||||||
|
echo "Contents of $OUTDIR:"
|
||||||
|
ls -la "$OUTDIR" || true
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
FINAL="${APP}-${TAG}-${PLATFORM}-${ARCH}"
|
||||||
|
cp -f "$SRC" "$OUTDIR/$FINAL"
|
||||||
|
|
||||||
|
echo "== Package =="
|
||||||
|
pushd "$OUTDIR" >/dev/null
|
||||||
|
zip -9 "${FINAL}.zip" "$FINAL"
|
||||||
|
popd >/dev/null
|
||||||
|
|
||||||
|
echo "OK: $OUTDIR/${FINAL}.zip"
|
||||||
|
|
||||||
|
```
|
||||||
|
Rendre le script executable :
|
||||||
|
|
||||||
|
`chmod +x scripts/release.sh`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Linux (Debian / zsh)
|
# Script Windows PowerShell — scripts/release.ps1
|
||||||
|
|
||||||
Étapes à suivre :
|
|
||||||
|
|
||||||
1. Récupérer les tags :
|
|
||||||
git fetch --tags
|
|
||||||
|
|
||||||
2. Se positionner sur le tag à release :
|
|
||||||
git checkout vX.Y.Z
|
|
||||||
|
|
||||||
3. Lancer le script :
|
|
||||||
./scripts/release.sh
|
|
||||||
|
|
||||||
Résultat attendu :
|
|
||||||
- build/bin/paycheck-vX.Y.Z-linux-amd64.zip
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Windows (PowerShell)
|
|
||||||
|
|
||||||
Étapes à suivre :
|
|
||||||
|
|
||||||
1. Récupérer les tags :
|
|
||||||
git fetch --tags
|
|
||||||
|
|
||||||
2. Se positionner sur le tag à release :
|
|
||||||
git checkout vX.Y.Z
|
|
||||||
|
|
||||||
3. Lancer le script :
|
|
||||||
.\scripts\release.ps1
|
|
||||||
|
|
||||||
Résultat attendu :
|
|
||||||
- build\bin\paycheck-vX.Y.Z-windows-amd64.zip
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Publication
|
|
||||||
|
|
||||||
Uploader les deux archives ZIP dans la Release Gitea correspondant au tag vX.Y.Z.
|
|
||||||
|
|
||||||
Aucun build ne doit être effectué depuis la branche main ou depuis un commit non taggé.
|
|
||||||
Reference in New Issue
Block a user