ci(release): publish the Arch package when the version changes
CI / check (push) Failing after 5s
Release / check (push) Failing after 4s
Release / release (push) Skipped

Releases were built and uploaded by hand, so the published package could
lag behind main and nothing checked the tree before it shipped. The new
version file drives a pipeline that lints, builds and tests the exact
commit, then creates the Gitea release and pushes the package to the
pacman repository.
This commit is contained in:
BlackAngelTV committed 2026-11-25 10:14:56 +01:00
1 parent afc53e370d
commit 7b64da8a38
9 files changed
+352 -4

No files matched your search

+6 -2
View File
@@ -12,7 +12,7 @@
pkgname=fws-kitty
pkgver=0.50.0
pkgrel=2
pkgrel=3
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'
@@ -21,6 +21,10 @@ license=('GPL-3.0-only')
# 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'
# The CI sets FWS_SOURCE_REF=commit=<sha> so the package is built from the exact
# commit being released instead of whatever main points at by the time makepkg
# clones. A local build keeps following _branch.
_source_ref=${FWS_SOURCE_REF:-branch=$_branch}
depends=(
python harfbuzz zlib libpng lcms2 xxhash openssl
@@ -43,7 +47,7 @@ provides=('kitty')
conflicts=('kitty')
source=(
"$pkgname::git+$_repo#branch=$_branch"
"$pkgname::git+$_repo#$_source_ref"
"nerdfonts-symbols.tar.xz::https://github.com/ryanoasis/nerd-fonts/releases/download/v3.5.1/NerdFontsSymbolsOnly.tar.xz"
)
sha256sums=('SKIP' '01172f37db8543edb102e5cb5c64101c9f4686630804d49b419aa07b23a69996')
+26 -1
View File
@@ -68,7 +68,32 @@ fonctionne pour héberger les fichiers, mais pacman a besoin d'URL stables pour
`fws-kitty.db.tar.gz` et les `.pkg.tar.zst`, ce qu'un simple dossier servi par
nginx (ou des assets de release) fournit directement.
Pour une publication automatique, il suffit d'enchaîner dans la CI :
## Publication automatique
Le fichier `version`, à la racine du dépôt, déclenche tout : un push sur `main`
qui le modifie lance `.gitea/workflows/package.yml`, qui rejoue le lint, le
build et les tests, construit le paquet avec ce `PKGBUILD` depuis le commit
exact, crée la release Gitea `v<version>` (paquet + empreinte SHA-256 en pièces
jointes) puis envoie le paquet à `repo.laxacube.ch`.
Le workflow a besoin de deux secrets du dépôt :
| Secret | Usage |
| --- | --- |
| `RELEASE_TOKEN` | créer la release et y attacher les fichiers |
| `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é
serveur. Le `PKGBUILD` lit `FWS_SOURCE_REF` (`commit=<sha>` 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.
Pour publier à la main :
```sh
makepkg -f --nodeps # ou -s avec un utilisateur autorisé à pacman
+42
View File
@@ -0,0 +1,42 @@
#!/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:
#
# version="$(packaging/check-version.sh)"
#
# It runs on the CI runner and locally, before any build.
set -eu
root=$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd)
version=$(tr -d '[:space:]' < "$root/version")
case "$version" in
''|*[!0-9.]*|.*|*..*|*.)
echo "::error file=version::expected MAJOR.MINOR.PATCH, got '$version'"
exit 1
;;
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
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
fi
printf '%s\n' "$version"