Wire up GitHub Actions for deb/brew build, test, and release

- Fix debian.yml: pin nfpm version, add permissions, improve test job
  with user creation, init test, and status check
- Fix homebrew.yml: use PyPI JSON API (macOS-compatible, no grep -oP),
  wait for PyPI availability on release, use generated formula not template,
  add Linux (Linuxbrew) test job alongside macOS
- Add release.yml orchestrator: pip → deb + brew + docker in order
- Add workflow_call triggers to pip.yml and docker.yml
- Fix build_brew.sh: replace grep -oP with Python-based PyPI API,
  add on_linux deps (pkg-config, openssl, libffi)
- Fix setup.sh: use GitHub API to find correct .deb download URL
  (filename includes version number)
- Fix postinstall.sh: create archivebox system user, pin version from
  package, check for systemd before daemon-reload
- Fix preremove.sh: stop service before removal, check for systemd
- Fix install.sh: fallback to latest if pinned version not on PyPI
- Add on_linux deps to brew formula for Linuxbrew support
- Tested: .deb builds, installs, creates user, runs archivebox init

https://claude.ai/code/session_01Vx1EsNrNySgsc8Y67dGzCn
This commit is contained in:
Claude
2026-03-15 02:50:14 +00:00
parent f3fcc1584c
commit c8f562ee37
12 changed files with 336 additions and 27 deletions

View File

@@ -20,7 +20,10 @@ fi
# Install or upgrade archivebox
if [ -n "$ARCHIVEBOX_VERSION" ]; then
echo "[+] Installing archivebox==$ARCHIVEBOX_VERSION..."
"$ARCHIVEBOX_VENV/bin/pip" install --quiet --upgrade "archivebox==$ARCHIVEBOX_VERSION"
"$ARCHIVEBOX_VENV/bin/pip" install --quiet --upgrade "archivebox==$ARCHIVEBOX_VERSION" || {
echo "[!] archivebox==$ARCHIVEBOX_VERSION not found on PyPI, installing latest..."
"$ARCHIVEBOX_VENV/bin/pip" install --quiet --upgrade archivebox
}
else
echo "[+] Installing latest archivebox..."
"$ARCHIVEBOX_VENV/bin/pip" install --quiet --upgrade archivebox

View File

@@ -19,6 +19,8 @@ section: "web"
priority: "optional"
depends:
# python3 >= 3.11 allows .deb to install on more systems;
# pip enforces the actual Python version requirement from pyproject.toml
- python3 (>= 3.11)
- python3-pip
- python3-venv

View File

@@ -2,4 +2,24 @@
# postinstall script for archivebox .deb package
set -e
# Create archivebox system user if it doesn't exist
if ! id -u archivebox >/dev/null 2>&1; then
useradd --system --shell /bin/bash --home-dir /var/lib/archivebox --create-home archivebox
echo "[+] Created archivebox system user"
fi
# Ensure data directory exists and is owned by archivebox
mkdir -p /var/lib/archivebox
chown archivebox:archivebox /var/lib/archivebox
# Run the virtualenv install script, pinning to the .deb package version
ARCHIVEBOX_VERSION="$(dpkg-query -W -f='${Version}' archivebox 2>/dev/null || echo '')"
export ARCHIVEBOX_VERSION
/opt/archivebox/install.sh
# Reload systemd to pick up the service file (skip if systemd is not running)
if command -v systemctl >/dev/null 2>&1 && [ -d /run/systemd/system ]; then
systemctl daemon-reload
echo "[i] To start ArchiveBox: sudo systemctl start archivebox"
echo "[i] To enable on boot: sudo systemctl enable archivebox"
fi

View File

@@ -2,8 +2,17 @@
# preremove script for archivebox .deb package
set -e
# Stop the service if running
if command -v systemctl >/dev/null 2>&1 && [ -d /run/systemd/system ]; then
systemctl stop archivebox 2>/dev/null || true
systemctl disable archivebox 2>/dev/null || true
fi
echo "[+] Removing ArchiveBox virtualenv..."
rm -rf /opt/archivebox/venv
echo "[i] Your ArchiveBox data directories have NOT been removed."
echo " Remove them manually if you no longer need them."
echo "[i] Your ArchiveBox data in /var/lib/archivebox has NOT been removed."
echo " The 'archivebox' system user has NOT been removed."
echo " Remove them manually if you no longer need them:"
echo " sudo rm -rf /var/lib/archivebox"
echo " sudo userdel archivebox"