Per-distro packaging: .deb / .rpm / AppImage + CI (1.8)

Ships beyond the Arch PKGBUILD so non-Arch users can install without a
Rust toolchain.

## Package metadata (Cargo.toml)

- [package.metadata.deb] for cargo-deb: declares the runtime subprocess
  deps (yt-dlp, ffmpeg, mpv, xdg-utils) that auto-detection can't find,
  plus libxcb1/libc6 link deps and libnotify4 as recommended.
- [package.metadata.generate-rpm] for cargo-generate-rpm with the
  RPM-distro dep names.
- Filled in license / repository / authors / readme package fields.

## scripts/package.sh

One entry point: `scripts/package.sh [deb|rpm|appimage|all]`. Builds the
release binary once and reuses it. Installs cargo-deb / cargo-generate-rpm
on demand; downloads appimagetool to dist/tools/ on first AppImage build.
Per-format failures are isolated and summarized at the end rather than
aborting the run. Output to dist/ (gitignored).

AppImage is hand-rolled (AppDir + AppRun + root desktop/icon) and bundles
only the GUI binary's shared-lib closure — yt-dlp/ffmpeg/mpv stay host
PATH deps, same as the package declarations.

## CI

.forgejo/workflows/release.yml builds all formats on a v* tag push and
attaches them to the Codeberg release via actions/forgejo-release. Manual
workflow_dispatch builds without uploading for smoke testing. Sets
APPIMAGE_EXTRACT_AND_RUN since CI containers lack FUSE.

## docs/PACKAGING.md

Per-format build + install instructions, the Arch PKGBUILD pointer, and
an honest Windows/macOS section: both are blocked on the Linux-only tray
(ksni) + file-picker (rfd xdg-portal) deps needing per-OS abstraction.
The rest of the stack already cross-compiles.

Verified .deb (dpkg control + payload correct) and .rpm (payload correct)
build cleanly through the script on this host.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Luna 2026-05-31 16:46:57 -07:00
parent 865ad87b22
commit 91ca20d687
5 changed files with 401 additions and 0 deletions

View file

@ -0,0 +1,84 @@
# Build Linux packages and attach them to the Codeberg release when a
# version tag (v*) is pushed.
#
# Codeberg runs Forgejo Actions, which is GitHub-Actions-compatible. The
# heavy lifting is in scripts/package.sh — this workflow just provisions
# a build environment, runs it, and uploads the artifacts.
#
# Manual trigger (workflow_dispatch) is included so you can smoke-test the
# build without cutting a tag; that path builds the packages but skips the
# release-upload step.
name: release
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
packages:
runs-on: docker
# A Debian-based image gives us dpkg + the build toolchain cargo-deb
# expects, and rustup for a pinned toolchain.
container:
image: rust:1.85-bookworm
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install build dependencies
# libxcb + friends are needed to *link* the eframe/winit GUI even
# in headless CI. curl + file are used by the packaging script and
# appimagetool. rpm provides rpmbuild for cargo-generate-rpm's
# payload assembly on a Debian host.
run: |
apt-get update
apt-get install -y --no-install-recommends \
libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev \
curl file rpm ca-certificates
- name: Cache cargo registry + build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
- name: Build packages
# FUSE isn't available in most CI containers, so tell appimagetool
# to extract-and-run instead of mounting. The script downloads
# appimagetool itself.
env:
APPIMAGE_EXTRACT_AND_RUN: '1'
run: |
chmod +x scripts/package.sh
scripts/package.sh all
- name: List artifacts
run: ls -la dist/
- name: Upload to release
# Only attaches to a release when triggered by a tag push. The
# forgejo-release action creates the release if it doesn't exist
# and uploads every file under dist/.
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/forgejo-release@v2
with:
direction: upload
url: https://codeberg.org
repo: ${{ github.repository }}
tag: ${{ github.ref_name }}
token: ${{ secrets.RELEASE_TOKEN }}
release-dir: dist
release-notes: |
Automated build for ${{ github.ref_name }}.
Artifacts:
- `.deb` — Debian / Ubuntu / Mint
- `.rpm` — Fedora / RHEL / openSUSE
- `.AppImage` — any Linux (chmod +x and run)
Runtime requirements: yt-dlp, ffmpeg, mpv, xdg-utils on PATH.