From d9a85fd8d7e7d98a2f11b2d046f47fe388d4641b Mon Sep 17 00:00:00 2001 From: Peter van Arkel Date: Tue, 24 Nov 2026 08:50:45 +0100 Subject: [PATCH] Build Debian artifacts directly from annotated release tags --- .gitea/workflows/ci.yml | 5 ++++- docs/deployment.md | 13 ++++++++----- tools/build_deb.py | 17 ++++++++++++++--- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index a955899..f6c4e98 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -66,6 +66,9 @@ jobs: python tools/check_core_release.py dist/*.tar.gz dist/*.whl python tools/build_deb.py dist/*.tar.gz dist/*.whl umask 077 - python tools/build_deb.py dist/*.tar.gz dist/*.whl --output rebuilt + git -c user.name='Coulobre CI' -c user.email='ci@hippogrief.nl' \ + tag --annotate coulobre-ci-artifacts -m 'Verify tagged build' + python tools/build_deb.py dist/*.tar.gz dist/*.whl \ + --ref coulobre-ci-artifacts --output rebuilt cmp dist/*.deb rebuilt/*.deb dpkg-deb --info dist/*.deb diff --git a/docs/deployment.md b/docs/deployment.md index ce4c2bb..5a2a872 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -145,22 +145,25 @@ and installs the selected operating system services and Python dependencies. ### Use the Gitea APT repository Use the `resolute` suite on Ubuntu 26.04 or `trixie` on Debian 13. The `main` -component carries final releases. Add `candidate` to the component list on a -test host to opt in to release candidates. A version like `0.13.0~rc1` sorts -before `0.13.0` in APT. +component carries final releases. Use `candidate` on a test host to opt in to +release candidates. A version like `0.13.0~rc1` sorts before `0.13.0` in APT. ```sh suite=resolute +component=main registry=https://code.hosting.hippogrief.nl/api/packages/hippogrief/debian sudo install -d -m 0755 /etc/apt/keyrings sudo curl -fsS "$registry/repository.key" -o /etc/apt/keyrings/hippogrief.asc sudo chmod 0644 /etc/apt/keyrings/hippogrief.asc -printf 'deb [signed-by=/etc/apt/keyrings/hippogrief.asc] %s %s main\n' \ - "$registry" "$suite" | sudo tee /etc/apt/sources.list.d/hippogrief.list +printf 'deb [signed-by=/etc/apt/keyrings/hippogrief.asc] %s %s %s\n' \ + "$registry" "$suite" "$component" | sudo tee /etc/apt/sources.list.d/hippogrief.list sudo apt update sudo apt install coulobre-panel ``` +Set `component=candidate` when testing a release candidate. Gitea adds the +`main` component to each suite when its first final package is published. + [Gitea Debian registry documentation](https://docs.gitea.com/usage/packages/debian/) ### Upgrade an installer-managed panel diff --git a/tools/build_deb.py b/tools/build_deb.py index 15ea787..6d54405 100644 --- a/tools/build_deb.py +++ b/tools/build_deb.py @@ -13,12 +13,23 @@ from check_core_release import ROOT, git_files, verify_release def build_package(source, wheel, ref, output): - verify_release(source, wheel, ref) - tracked = git_files(ref) + commit = subprocess.check_output( + [ + "git", + "rev-parse", + "--verify", + "--end-of-options", + f"{ref}^{{commit}}", + ], + cwd=ROOT, + text=True, + ).strip() + verify_release(source, wheel, commit) + tracked = git_files(commit) project = tomllib.loads(tracked["pyproject.toml"].decode())["project"] version = project["version"].replace("rc", "~rc") epoch = subprocess.check_output( - ["git", "show", "-s", "--format=%ct", ref], cwd=ROOT, text=True + ["git", "show", "-s", "--format=%ct", commit], cwd=ROOT, text=True ).strip() output.mkdir(parents=True, exist_ok=True) target = output / f"coulobre-panel_{version}_all.deb"