diff --git a/README.md b/README.md index 27f5c95..34a493b 100644 --- a/README.md +++ b/README.md @@ -301,20 +301,27 @@ _branch=feat/file-manager-panel ### Publication automatique -`version`, à la racine, est la source de vérité des releases : il doit rester -égal à `version` dans `kitty/constants.py` et à `pkgver` dans -`packaging/PKGBUILD` (`packaging/check-version.sh` vérifie les trois et échoue -sinon). Un push sur `main` qui modifie `version` déclenche +`version`, à la racine, est la source de vérité des releases. Il suit la version +du fork FWS (`0.1.6`), pas la version amont de kitty embarquée dans le paquet : +c'est elle qui nomme le tag, la release et le paquet +`fws-kitty--`. Il doit rester égal à `pkgver` dans +`packaging/PKGBUILD` et à la version affichée par `fws-kitty` +(`tools/cli/help.go`, `kitty/launcher/main.c`) ; `packaging/check-version.sh` +vérifie l'ensemble, ainsi que `_kittyver` du `PKGBUILD` contre +`kitty/constants.py`, et échoue sinon. Un push sur `main` qui modifie `version` +déclenche `.gitea/workflows/package.yml` : lint, build, tests, paquet `makepkg`, release Gitea `v` avec le paquet en pièce jointe, puis envoi à `repo.laxacube.ch`. `.gitea/workflows/ci.yml` rejoue les mêmes contrôles sur chaque PR et chaque push sur `main`. -Pour reconstruire la même version amont (correctif de packaging), incrémentez +Pour reconstruire la même version du fork (correctif de packaging), incrémentez `pkgrel` dans `packaging/PKGBUILD` puis lancez le workflow à la main -(*Actions → Release → Run workflow*) : le paquet `0.50.0-3` remplace alors le -`0.50.0-2`. Une nouvelle version demande `version`, `kitty/constants.py` et -`pkgver`, avec `pkgrel=1`. La publication vers `repo.laxacube.ch` utilise le +(*Actions → Release → Run workflow*) : le paquet `0.1.6-2` remplace alors le +`0.1.6-1`. Une nouvelle version du fork demande `version`, `pkgver` et les deux +front-ends, avec `pkgrel=1` ; pour suivre une nouvelle version de kitty, mettre +à jour `_kittyver` et `kitty/constants.py`. La publication vers +`repo.laxacube.ch` utilise le secret `REPO_TOKEN` du dépôt, la release Gitea le secret `RELEASE_TOKEN` ; sans `REPO_TOKEN` la release est créée mais le dépôt pacman n'est pas mis à jour. diff --git a/packaging/PKGBUILD b/packaging/PKGBUILD index 61adbb3..14e1efd 100644 --- a/packaging/PKGBUILD +++ b/packaging/PKGBUILD @@ -11,13 +11,19 @@ # upstream package, hence provides/conflicts. pkgname=fws-kitty -pkgver=0.50.0 -pkgrel=3 +# Fork version from the version file: it names the release and the package. +# The upstream kitty release built inside is tracked by _kittyver below. +pkgver=0.1.6 +pkgrel=1 pkgdesc='Fast, feature-rich, GPU based terminal (FWS fork with the file-manager kitten)' arch=('x86_64' 'aarch64') url='https://gitea.nocode-var.tech/FWS/FWS-Kitty' license=('GPL-3.0-only') +# Upstream kitty release shipped by this package. It is independent from pkgver +# and must match kitty/constants.py (checked by check-version.sh). +_kittyver=0.50.0 + # Replace main with the tag or commit to ship once the release is cut. _branch=main _repo='https://gitea.nocode-var.tech/FWS/FWS-Kitty.git' diff --git a/packaging/README.md b/packaging/README.md index 34f4e1f..08e104c 100644 --- a/packaging/README.md +++ b/packaging/README.md @@ -84,14 +84,17 @@ Le workflow a besoin de deux secrets du dépôt : | `REPO_TOKEN` | `POST https://repo.laxacube.ch/api/packages` | Sans `REPO_TOKEN`, la release est créée mais le dépôt pacman n'est pas mis à -jour (le workflow émet un avertissement). Pour reconstruire la même version -amont, incrémentez `pkgrel` ici et lancez le workflow manuellement ; le paquet -`0.50.0-3` remplace le `0.50.0-2` dans la base `fws.db` reconstruite côté +jour (le workflow émet un avertissement). Pour reconstruire la même version du +fork, incrémentez `pkgrel` ici et lancez le workflow manuellement ; le paquet +`0.1.6-2` remplace le `0.1.6-1` dans la base `fws.db` reconstruite côté serveur. Le `PKGBUILD` lit `FWS_SOURCE_REF` (`commit=` depuis la CI) pour construire le commit publié plutôt que la tête de `main`. -`packaging/check-version.sh` vérifie avant le build que `version`, -`kitty/constants.py` et `pkgver` ci-dessus sont identiques. +`pkgver` est la version du fork FWS (fichier `version` à la racine), pas celle +de kitty : la version amont embarquée est dans `_kittyver`. +`packaging/check-version.sh` vérifie avant le build que `version` et `pkgver` +concordent avec la version compilée dans `tools/cli/help.go` et +`kitty/launcher/main.c`, et que `_kittyver` correspond à `kitty/constants.py`. ### Runner diff --git a/packaging/check-version.sh b/packaging/check-version.sh index 4b3c21a..f9da369 100755 --- a/packaging/check-version.sh +++ b/packaging/check-version.sh @@ -1,8 +1,10 @@ #!/bin/sh # The version file is the single source of truth for a release: it triggers the -# packaging workflow and names the tag and the Gitea release. The version is -# also duplicated where kitty and makepkg expect it, so this script checks they -# still agree and prints the version for the workflows to reuse: +# packaging workflow and names the tag, the Gitea release and the Arch package. +# It tracks the FWS fork version, which is independent from the upstream kitty +# release shipped inside the package. Both numbers are duplicated where the +# build reads them, so this script checks they still agree and prints the +# release version for the workflows to reuse: # # version="$(packaging/check-version.sh)" # @@ -10,33 +12,44 @@ set -eu root=$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd) + +fail() { + echo "::error file=$1::$2" + exit 1 +} + version=$(tr -d '[:space:]' < "$root/version") case "$version" in ''|*[!0-9.]*|.*|*..*|*.) - echo "::error file=version::expected MAJOR.MINOR.PATCH, got '$version'" - exit 1 + fail version "expected MAJOR.MINOR.PATCH, got '$version'" ;; esac if [ "$(printf '%s' "$version" | awk -F. '{print NF}')" -ne 3 ]; then - echo "::error file=version::expected MAJOR.MINOR.PATCH, got '$version'" - exit 1 -fi - -# kitty reads its own version from this constant, and it ends up in the -# binaries and the man pages, so the release version must not drift from it. -constants=$(sed -n 's/^version: Version = Version(\([0-9]*\), \([0-9]*\), \([0-9]*\)).*/\1.\2.\3/p' "$root/kitty/constants.py" | head -n 1) -if [ "$constants" != "$version" ]; then - echo "::error file=kitty/constants.py::kitty reports '$constants' but the version file says '$version'" - exit 1 + fail version "expected MAJOR.MINOR.PATCH, got '$version'" fi # makepkg names the package from pkgver, so an out-of-date PKGBUILD would # publish a package whose name does not match its release. pkgver=$(sed -n 's/^pkgver=//p' "$root/packaging/PKGBUILD" | head -n 1) if [ "$pkgver" != "$version" ]; then - echo "::error file=packaging/PKGBUILD::pkgver is '$pkgver' but the version file says '$version'" - exit 1 + fail packaging/PKGBUILD "pkgver is '$pkgver' but the version file says '$version'" fi +# The upstream kitty release follows kitty, not the fork: it lives in its own +# variable and must keep matching the constant kitty compiles into the binaries. +kitty_version=$(sed -n 's/^_kittyver=//p' "$root/packaging/PKGBUILD" | head -n 1) +constants=$(sed -n 's/^version: Version = Version(\([0-9]*\), \([0-9]*\), \([0-9]*\)).*/\1.\2.\3/p' "$root/kitty/constants.py" | head -n 1) +if [ "$constants" != "$kitty_version" ]; then + fail kitty/constants.py "kitty reports '$constants' but _kittyver in the PKGBUILD says '$kitty_version'" +fi + +# The fork version is hard-coded in both front-ends, so bumping only the version +# file would ship binaries announcing the previous release. +for f in tools/cli/help.go kitty/launcher/main.c; do + if ! grep -qF "$version" "$root/$f"; then + fail "$f" "the fork version '$version' is not set in this file" + fi +done + printf '%s\n' "$version" diff --git a/version b/version index 564edf8..c946ee6 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.50.0 +0.1.6