diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aa09481b..e5c62e1f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -213,7 +213,7 @@ jobs: - name: Apply version override if: inputs.version != '' run: cargo xtask version set "$PDFCRAFT_VERSION" - - name: Build and package (AppImage, deb, rpm, tar.gz) + - name: Build and package (AppImage, deb, rpm, tar.gz, CLI tar.gz) env: CRAFT_FONTS_DIR: ${{ github.workspace }}/craft-fonts CRAFT_FONTS_REQUIRED: "1" @@ -223,6 +223,12 @@ jobs: dpkg-deb --info dist/release/*.deb dpkg-deb --contents dist/release/*.deb | grep -E 'usr/bin/pdfcraft$|metainfo|applications' ldd target/release/pdfcraft + # The CLI-only archive: the binary and its licences, and it runs. + cli="dist/release/pdfcraft-cli-$PDFCRAFT_VERSION-linux-${{ matrix.arch }}.tar.gz" + tar -tzf "$cli" | grep -E '/pdfcraft-cli$' + tar -tzf "$cli" | grep -E '/LICENSE-APACHE$' + mkdir -p "$RUNNER_TEMP/cli" && tar -xzf "$cli" -C "$RUNNER_TEMP/cli" + "$RUNNER_TEMP/cli/pdfcraft-cli-$PDFCRAFT_VERSION-linux-${{ matrix.arch }}/pdfcraft-cli" --version python3 -c "import yaml; m = yaml.safe_load(open('packaging/linux/flatpak/ai.storyteller.pdfcraft.yml')); assert m['id'] == 'ai.storyteller.pdfcraft'" for appimage in dist/release/*.AppImage; do chmod +x "$appimage" diff --git a/README.md b/README.md index 43342478..79f0a6c0 100644 --- a/README.md +++ b/README.md @@ -451,6 +451,9 @@ Use the MSI for your architecture. Per-user installation overrides are not suppo | Debian/Ubuntu | `pdfcraft--linux-x86_64.deb` | `pdfcraft--linux-aarch64.deb` | | | Fedora/RHEL/openSUSE | `pdfcraft--linux-x86_64.rpm` | `pdfcraft--linux-aarch64.rpm` | | | Tarball | `pdfcraft--linux-x86_64.tar.gz` | `pdfcraft--linux-aarch64.tar.gz` | Unpack anywhere | +| Command-line tool | `pdfcraft-cli--linux-x86_64.tar.gz` | `pdfcraft-cli--linux-aarch64.tar.gz` | `pdfcraft-cli` alone (and its opt-in MCP server), for servers, CI and agents | + +Every Linux build needs glibc 2.35 or newer (Ubuntu 22.04+, Debian 12+, Fedora 36+, RHEL 10). ### FreeBSD diff --git a/docs/releasing.md b/docs/releasing.md index 30900549..5fb8d70c 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -48,8 +48,8 @@ published (`gh workflow run release.yml --ref `). | Windows 10+ x64 | `pdfcraft--windows-x64.msi`, `pdfcraft--windows-x64-portable.zip` | `windows-latest` | | Windows 10+ x86 (32-bit) | `pdfcraft--windows-x86.msi`, `pdfcraft--windows-x86-portable.zip` | `windows-latest` | | Windows 11 on ARM64 | `pdfcraft--windows-arm64.msi`, `pdfcraft--windows-arm64-portable.zip` | `windows-latest` (cross-compiled) | -| Linux x86_64 | `pdfcraft--linux-x86_64.{AppImage,AppImage.zsync,deb,rpm,tar.gz}` | `ubuntu-22.04` | -| Linux aarch64 | `pdfcraft--linux-aarch64.{AppImage,AppImage.zsync,deb,rpm,tar.gz}` | `ubuntu-22.04-arm` | +| Linux x86_64 | `pdfcraft--linux-x86_64.{AppImage,AppImage.zsync,deb,rpm,tar.gz}`, `pdfcraft-cli--linux-x86_64.tar.gz` | `ubuntu-22.04` | +| Linux aarch64 | `pdfcraft--linux-aarch64.{AppImage,AppImage.zsync,deb,rpm,tar.gz}`, `pdfcraft-cli--linux-aarch64.tar.gz` | `ubuntu-22.04-arm` | | Flatpak x86_64 | `pdfcraft--linux-x86_64.flatpak` | `ubuntu-24.04` (repackages the Linux tarball) | | Flatpak aarch64 | `pdfcraft--linux-aarch64.flatpak` | `ubuntu-24.04-arm` (repackages the Linux tarball) | | FreeBSD 14 x86_64 | `pdfcraft--freebsd-x86_64.tar.gz` | FreeBSD VM on `ubuntu-latest` | @@ -131,7 +131,9 @@ Locally: `dotnet tool install -g wix --version 5.0.2`, then `pwsh packaging/wind `packaging/linux/package.sh` stages one FHS tree (both binaries, the desktop entry, hicolor icons, AppStream metainfo) and makes every format from it: an **AppImage** (any distribution, nothing to install), a **.deb** and an **.rpm** (built with [nfpm](https://nfpm.goreleaser.com) from -`nfpm.yaml`; they integrate with the menu, MIME and icon caches), and a **.tar.gz**. +`nfpm.yaml`; they integrate with the menu, MIME and icon caches), a **.tar.gz**, and a CLI-only +**`pdfcraft-cli--linux-.tar.gz`** (the stripped `pdfcraft-cli` plus the licences and +README, for servers, CI and agent sandboxes). `--formats` picks a subset (`appimage deb rpm tar cli`). The binaries are built on Ubuntu 22.04, the oldest GitHub-hosted image, so they need only **glibc ≥ 2.35**: Ubuntu 22.04+, Debian 12+, Fedora 36+, RHEL 10. Windowing (X11, Wayland, diff --git a/packaging/env.sh b/packaging/env.sh index d4023a1a..a903be9c 100644 --- a/packaging/env.sh +++ b/packaging/env.sh @@ -47,7 +47,7 @@ warn() { # Copy licence and readme files that exist into a package directory. copy_docs() { local dest="$1" f - for f in README.md LICENSE LICENSE-MIT LICENSE-APACHE COPYRIGHT; do + for f in README.md LICENSE LICENSE-MIT LICENSE-APACHE COPYRIGHT NOTICE; do if [ -f "$ROOT/$f" ]; then cp "$ROOT/$f" "$dest/"; fi done copy_font_licences "$dest" diff --git a/packaging/linux/package.sh b/packaging/linux/package.sh index ae0166e2..06b04a9e 100755 --- a/packaging/linux/package.sh +++ b/packaging/linux/package.sh @@ -6,8 +6,9 @@ # $DIST/pdfcraft--linux-.deb Debian, Ubuntu, Mint, Pop!_OS, ... # $DIST/pdfcraft--linux-.rpm Fedora, openSUSE, RHEL, ... # $DIST/pdfcraft--linux-.tar.gz plain FHS-style tree (bin/, share/) +# $DIST/pdfcraft-cli--linux-.tar.gz the headless CLI alone (servers, CI, agents) # -# Usage: packaging/linux/package.sh [--skip-build] [--formats "appimage deb rpm tar"] +# Usage: packaging/linux/package.sh [--skip-build] [--formats "appimage deb rpm tar cli"] # # Needs: cargo; nfpm for deb/rpm (https://nfpm.goreleaser.com); appimagetool for the AppImage # (downloaded into $CARGO_TARGET_DIR if missing). Build on an old distro (CI: Ubuntu 22.04, @@ -20,12 +21,12 @@ HERE="$ROOT/packaging/linux" APP_ID=ai.storyteller.pdfcraft SKIP_BUILD=0 -FORMATS="appimage deb rpm tar" +FORMATS="appimage deb rpm tar cli" while [ $# -gt 0 ]; do case "$1" in --skip-build) SKIP_BUILD=1; shift ;; --formats) FORMATS="$2"; shift 2 ;; - -h | --help) sed -n '2,15p' "$0"; exit 0 ;; + -h | --help) sed -n '2,16p' "$0"; exit 0 ;; *) echo "unknown argument: $1" >&2; exit 2 ;; esac done @@ -80,6 +81,19 @@ if has tar; then echo "wrote $DIST/$BASENAME.tar.gz" fi +# ---- CLI-only .tar.gz --------------------------------------------------------------------------- +# The stripped pdfcraft-cli (and its opt-in MCP server) with the licences, for machines that never +# open a window. Like the other formats it needs glibc >= the build host's. +if has cli; then + CLI_NAME="pdfcraft-cli-$VERSION-linux-$ARCH" + CLI_DIR="$WORK/cli/$CLI_NAME" + mkdir -p "$CLI_DIR" + cp "$STAGE/usr/bin/pdfcraft-cli" "$CLI_DIR/" + copy_docs "$CLI_DIR" + tar -C "$WORK/cli" -czf "$DIST/$CLI_NAME.tar.gz" "$CLI_NAME" + echo "wrote $DIST/$CLI_NAME.tar.gz" +fi + # ---- .deb / .rpm -------------------------------------------------------------------------------- if has deb || has rpm; then command -v nfpm >/dev/null || { echo "error: nfpm not found (https://nfpm.goreleaser.com/install/)" >&2; exit 1; }