Files
FWS-Kitty/packaging/check-version.sh
T
BlackAngelTV f38246f71d
CI / check (push) Canceled after 10m13s
Release / check (push) Successful in 3m6s
Release / release (push) Failing after 3m35s
fix(packaging): release the FWS fork version instead of the kitty version
The release tag, the Gitea release and the Arch package were named after the
upstream kitty release (0.50.0), so a fork release was indistinguishable from
an upstream one and disagreed with the version the binaries announce (0.1.6).
The version file and pkgver now follow the fork, while the embedded kitty
release stays in _kittyver and is checked against kitty/constants.py.
2026-11-25 10:41:18 +01:00

56 lines
2.2 KiB
Bash
Executable File

#!/bin/sh
# The version file is the single source of truth for a release: it triggers the
# 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)"
#
# It runs on the CI runner and locally, before any build.
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.]*|.*|*..*|*.)
fail version "expected MAJOR.MINOR.PATCH, got '$version'"
;;
esac
if [ "$(printf '%s' "$version" | awk -F. '{print NF}')" -ne 3 ]; then
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
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"