From 73bf92b5a9656f3357368ef4ba82c272fb9fa53b Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Thu, 8 Oct 2026 10:00:34 -0400 Subject: [PATCH] Release: Flatpak bundles, AppImage zsync updates, README Downloads (#500) * Release: Flatpak x86_64/aarch64 bundles, AppImage zsync updates, README Downloads - New `flatpak` matrix job (ubuntu-24.04 and ubuntu-24.04-arm) repackages each Linux tarball into vectorcraft--linux-.flatpak via packaging/linux/flatpak-bundle.sh and the new ai.storyteller.vectorcraft.bundle.yml; packaging-lint keeps its runtime and finish-args identical to the from-source Flathub manifest. - AppImages embed gh-releases-zsync update information and ship a .zsync beside them; the Linux job checks both. - Jobs that sign nothing (version, linux, flatpak, freebsd, web) leave the `release` environment, so a branch workflow_dispatch is a dry run; the draft-release job still needs the signed macOS/Windows jobs. - README: a Downloads section listing every build; docs/releasing.md updated. Co-Authored-By: Claude Opus 5.5 * Release: read AppImage update info without extract-and-run With APPIMAGE_EXTRACT_AND_RUN=1 the runtime forwards --appimage-updateinformation to the app, which then tries to open a window and fails on the headless runner. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Brandon Thomas Co-authored-by: Claude Opus 5.5 --- .github/workflows/packaging-lint.yml | 11 ++- .github/workflows/release.yml | 72 ++++++++++++++++--- README.md | 45 ++++++++++++ docs/releasing.md | 34 ++++++--- packaging/linux/flatpak-bundle.sh | 72 +++++++++++++++++++ .../ai.storyteller.vectorcraft.bundle.yml | 47 ++++++++++++ .../flatpak/ai.storyteller.vectorcraft.yml | 2 + packaging/linux/package.sh | 28 ++++++-- 8 files changed, 288 insertions(+), 23 deletions(-) create mode 100755 packaging/linux/flatpak-bundle.sh create mode 100644 packaging/linux/flatpak/ai.storyteller.vectorcraft.bundle.yml diff --git a/.github/workflows/packaging-lint.yml b/.github/workflows/packaging-lint.yml index 23db4e93..1ad33f98 100644 --- a/.github/workflows/packaging-lint.yml +++ b/.github/workflows/packaging-lint.yml @@ -54,4 +54,13 @@ jobs: desktop-file-validate packaging/linux/ai.storyteller.vectorcraft.desktop sed -e 's/@VERSION@/0.0.0/' -e 's/@DATE@/2026-01-01/' packaging/linux/ai.storyteller.vectorcraft.metainfo.xml.in >"$RUNNER_TEMP/ai.storyteller.vectorcraft.metainfo.xml" appstreamcli validate --no-net --explain "$RUNNER_TEMP/ai.storyteller.vectorcraft.metainfo.xml" - python3 -c "import yaml; m = yaml.safe_load(open('packaging/linux/flatpak/ai.storyteller.vectorcraft.yml')); assert m['id'] == 'ai.storyteller.vectorcraft' and m['command'] == 'vectorcraft'" + python3 - <<'EOF' + import yaml + src = yaml.safe_load(open("packaging/linux/flatpak/ai.storyteller.vectorcraft.yml")) + bundle = yaml.safe_load(open("packaging/linux/flatpak/ai.storyteller.vectorcraft.bundle.yml")) + for m in (src, bundle): + assert m["id"] == "ai.storyteller.vectorcraft" and m["command"] == "vectorcraft", m["id"] + for key in ("runtime", "runtime-version", "sdk", "finish-args"): + assert src[key] == bundle[key], f"Flatpak manifests disagree on {key}: {src[key]} vs {bundle[key]}" + print("Flatpak manifests ok") + EOF diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c43c2f06..8bd5dfee 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,11 @@ # Release pipeline: every push to `release` builds signed installers for every platform and # creates or updates the draft GitHub Release "VectorCraft v". See docs/releasing.md. # -# All jobs run in the `release` environment (restricted to the `release` branch), which holds -# the signing secrets. Every secret is optional: missing ones produce unsigned artifacts and a -# warning, never a failed build. +# Jobs that sign (macOS, Windows) and the job that creates the release run in the `release` +# environment (restricted to the `release` branch), which holds the signing secrets. Every secret +# is optional: missing ones produce unsigned artifacts and a warning, never a failed build. The +# other jobs sign nothing and get no environment, so a `workflow_dispatch` on any branch is a dry +# run: they build and upload artifacts, the signed jobs are refused, and no release is drafted. name: Release on: @@ -35,7 +37,7 @@ jobs: version: name: version runs-on: ubuntu-latest - environment: release + # No `environment: release`: no secrets here. outputs: version: ${{ steps.v.outputs.version }} date: ${{ steps.v.outputs.date }} @@ -175,7 +177,7 @@ jobs: # The oldest GitHub-hosted image, so the binaries only need glibc >= 2.35 (Ubuntu 22.04+, # Debian 12+, Fedora 36+, RHEL 10). See docs/releasing.md. runs-on: ${{ matrix.runner }} - environment: release + # No `environment: release`: Linux packages are not signed (checksums in SHA256SUMS.txt). strategy: fail-fast: false matrix: @@ -200,7 +202,7 @@ jobs: sudo apt-get update sudo apt-get install -y --no-install-recommends \ libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev \ - desktop-file-utils appstream python3-yaml + desktop-file-utils appstream python3-yaml zsync curl -fsSL -o "$RUNNER_TEMP/nfpm.deb" \ "https://github.com/goreleaser/nfpm/releases/download/v${NFPM_VERSION}/nfpm_${NFPM_VERSION}_${{ matrix.deb }}.deb" sudo dpkg -i "$RUNNER_TEMP/nfpm.deb" @@ -225,6 +227,12 @@ jobs: for appimage in dist/release/*.AppImage; do chmod +x "$appimage" APPIMAGE_EXTRACT_AND_RUN=1 "$appimage" --version + # Update information is embedded, and the .zsync for delta updates sits beside it. + # No APPIMAGE_EXTRACT_AND_RUN here: with it the runtime passes --appimage-* flags on + # to the app instead of answering them itself. + "$appimage" --appimage-updateinformation \ + | grep -F "gh-releases-zsync|${GITHUB_REPOSITORY%%/*}|${GITHUB_REPOSITORY#*/}|latest|vectorcraft-*-linux-${{ matrix.arch }}.AppImage.zsync" + test -s "$appimage.zsync" done - uses: actions/upload-artifact@v4 with: @@ -232,13 +240,52 @@ jobs: path: dist/release/* if-no-files-found: error + flatpak: + name: Flatpak ${{ matrix.arch }} + needs: [version, linux] + # Repackages the Linux job's tarball (the same binaries as the AppImage/deb/rpm); no Rust + # build here. 24.04 for a newer flatpak-builder (1.4) than 22.04 ships. + runs-on: ${{ matrix.runner }} + # No `environment: release`: this job signs nothing, so it gets no release secrets. + strategy: + fail-fast: false + matrix: + include: + - { arch: x86_64, runner: ubuntu-24.04 } + - { arch: aarch64, runner: ubuntu-24.04-arm } + env: + VECTORCRAFT_VERSION: ${{ needs.version.outputs.version }} + VECTORCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }} + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: release-linux-${{ matrix.arch }} + path: dist/linux + - name: Install flatpak-builder + run: | + sudo apt-get update + # librsvg2-common: the SVG pixbuf loader. flatpak-builder runs the host's + # `appstreamcli compose`, which renders the scalable icon and fails without it. + sudo apt-get install -y --no-install-recommends flatpak flatpak-builder librsvg2-common + # Ubuntu 24.04's AppArmor blocks the unprivileged user namespaces bubblewrap needs. + sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 + - name: Build the Flatpak bundle + run: packaging/linux/flatpak-bundle.sh "dist/linux/vectorcraft-$VECTORCRAFT_VERSION-linux-${{ matrix.arch }}.tar.gz" + - uses: actions/upload-artifact@v4 + with: + name: release-flatpak-${{ matrix.arch }} + path: dist/release/*.flatpak + if-no-files-found: error + freebsd: name: FreeBSD x86_64 needs: version - # GitHub has no FreeBSD runners: build in a FreeBSD 14.3 VM (same image as freebsd.yml). + # GitHub has no FreeBSD runners: build in a FreeBSD 14.3 VM (same image and packages as + # freebsd.yml). runs-on: ubuntu-latest timeout-minutes: 150 - environment: release + # No `environment: release`: this job signs nothing, so it gets no release secrets. env: VECTORCRAFT_VERSION: ${{ needs.version.outputs.version }} VECTORCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }} @@ -262,6 +309,7 @@ jobs: with: release: "14.3" usesh: true + cpu: 4 mem: 12288 # Passed through by name; never templated into the script. envs: "VECTORCRAFT_VERSION VECTORCRAFT_BUILD_DATE VECTORCRAFT_BUILD_SHA" @@ -276,6 +324,8 @@ jobs: export CRAFT_FONTS_DIR="$PWD/craft-fonts" CRAFT_FONTS_REQUIRED=1 export CARGO_TARGET_DIR=/var/tmp/vectorcraft-target CARGO_BUILD_JOBS=4 bash packaging/freebsd/package.sh + tar -tzf dist/release/vectorcraft-*-freebsd-x86_64.tar.gz \ + | grep -E '/bin/vectorcraft$|/bin/vectorcraft-cli$|/share/applications/ai\.storyteller\.vectorcraft\.desktop$' - uses: actions/upload-artifact@v4 with: name: release-freebsd @@ -286,7 +336,7 @@ jobs: name: Web (wasm) needs: version runs-on: ubuntu-latest - environment: release + # No `environment: release`: no secrets here. env: VECTORCRAFT_VERSION: ${{ needs.version.outputs.version }} VECTORCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }} @@ -327,7 +377,9 @@ jobs: release: name: Draft GitHub Release - needs: [version, macos, windows, linux, freebsd, web] + # Needs the signed jobs, so a branch dry run (where the environment refuses them) never + # drafts a release. + needs: [version, macos, windows, linux, flatpak, freebsd, web] runs-on: ubuntu-latest environment: release permissions: diff --git a/README.md b/README.md index dae5a6a6..08e686b7 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ Why VectorCraft · Quick start · Status · + Downloads · The Crafting Apps · License

@@ -216,6 +217,50 @@ Agent and contributor rules (clean-room, the asset policy, no panics in shipped explains how VectorCraft avoids crashing, and [`docs/releasing.md`](docs/releasing.md) how releases are built, signed and published. Every bundled asset is listed with its licence in [`ASSETS.md`](ASSETS.md). +## Downloads + +Every [release](https://github.com/storytold/vectorcraft/releases/latest) ships these builds. `` is the +version number; `SHA256SUMS.txt` lists a checksum for every file. + +### macOS + +| Build | File | Notes | +|---|---|---| +| App, universal (Apple silicon + Intel) | `vectorcraft--macos-universal.dmg` | Signed and notarized | +| Command-line tool, universal | `vectorcraft-cli--macos-universal.zip` | Signed and notarized | + +### Windows + +| Build | Installer | Portable | +|---|---|---| +| x64 (64-bit Intel/AMD) | `vectorcraft--windows-x64.msi` | `vectorcraft--windows-x64-portable.zip` | +| arm64 (Snapdragon and other ARM PCs) | `vectorcraft--windows-arm64.msi` | `vectorcraft--windows-arm64-portable.zip` | +| x86 (32-bit) | `vectorcraft--windows-x86.msi` | `vectorcraft--windows-x86-portable.zip` | + +Installers and executables are code-signed. + +### Linux + +| Format | x86_64 | aarch64 (ARM64) | Notes | +|---|---|---|---| +| AppImage | `vectorcraft--linux-x86_64.AppImage` | `vectorcraft--linux-aarch64.AppImage` | Runs anywhere; updates itself with [AppImageUpdate](https://github.com/AppImageCommunity/AppImageUpdate) (`.zsync` files) | +| Flatpak | `vectorcraft--linux-x86_64.flatpak` | `vectorcraft--linux-aarch64.flatpak` | Sandboxed; `flatpak install --user ` | +| Debian/Ubuntu | `vectorcraft--linux-x86_64.deb` | `vectorcraft--linux-aarch64.deb` | | +| Fedora/RHEL/openSUSE | `vectorcraft--linux-x86_64.rpm` | `vectorcraft--linux-aarch64.rpm` | | +| Tarball | `vectorcraft--linux-x86_64.tar.gz` | `vectorcraft--linux-aarch64.tar.gz` | Unpack anywhere | + +### FreeBSD + +| Build | File | +|---|---| +| x86_64 | `vectorcraft--freebsd-x86_64.tar.gz` | + +### Web (WebAssembly) + +| Build | File | Notes | +|---|---|---| +| Static site | `vectorcraft-web-.zip` | Runs in a modern browser; host it on any static server | + ## The Crafting Apps VectorCraft is one of the **Crafting Apps**: free, open-source creative tools from the diff --git a/docs/releasing.md b/docs/releasing.md index 5389dd15..a3b238ed 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -1,7 +1,7 @@ # Releasing VectorCraft Every push to the `release` branch runs `.github/workflows/release.yml`. The workflow builds -installers for macOS, Windows, Linux and FreeBSD, plus the web build, and creates or updates a +installers for macOS, Windows, Linux (including Flatpak bundles) and FreeBSD, plus the web build, and creates or updates a **draft** GitHub Release named `VectorCraft v`. Nobody sees a draft until a maintainer publishes it. @@ -34,8 +34,11 @@ Once the draft is published, the workflow refuses to touch that version again: b **Test runs:** *Actions › Release › Run workflow* runs the whole pipeline by hand. The optional `version` input (such as `0.4.0-rc.1`) overrides `Cargo.toml` for that run only; each build job -applies it with `cargo xtask version set` before building. The jobs run in the `release` -environment, which only the `release` branch can use, so pick that branch in the dialog. +applies it with `cargo xtask version set` before building. The signing jobs (macOS, Windows) and +the draft-release job run in the `release` environment, which only the `release` branch can use, so +pick that branch for a full run. Run on any other branch, it is a dry run: the Linux, Flatpak, +FreeBSD and web jobs build and upload their artifacts, the environment refuses the signing jobs, +and no draft release is created. ## What gets built @@ -47,6 +50,8 @@ environment, which only the `release` branch can use, so pick that branch in the | Windows on ARM64 | `vectorcraft--windows-arm64.msi`, `vectorcraft--windows-arm64-portable.zip` | `windows-latest` (cross-compiled) | | Linux x86_64 | `vectorcraft--linux-x86_64.{AppImage,deb,rpm,tar.gz}` | `ubuntu-22.04` | | Linux aarch64 | `vectorcraft--linux-aarch64.{AppImage,deb,rpm,tar.gz}` | `ubuntu-22.04-arm` | +| Linux AppImage updates | `vectorcraft--linux-{x86_64,aarch64}.AppImage.zsync` | with the AppImages | +| Flatpak x86_64, aarch64 | `vectorcraft--linux-{x86_64,aarch64}.flatpak` | `ubuntu-24.04`, `ubuntu-24.04-arm` (repackages the Linux tarball) | | FreeBSD 14 x86_64 | `vectorcraft--freebsd-x86_64.tar.gz` | a FreeBSD 14.3 VM on `ubuntu-latest` | | Web | `vectorcraft-web-.zip`, a static site (see [`packaging/web/README.md`](../packaging/web/README.md)) | `ubuntu-latest` | @@ -132,9 +137,21 @@ glibc 2.35 or newer: Ubuntu 22.04+, Debian 12+, Fedora 36+ and RHEL 10. Moving t image raises that floor, so do it deliberately. After packaging, the job prints the `.deb`'s metadata and contents, runs `ldd` on the binary and runs each AppImage with `--version`. -`packaging/linux/flatpak/ai.storyteller.vectorcraft.yml` is a Flatpak manifest ready for a -Flathub submission (its header says how to build it). The release doesn't build a Flatpak; the -workflows only check the manifest's id. +**AppImage updates.** Each AppImage embeds the update information +`gh-releases-zsync|storytold|vectorcraft|latest|vectorcraft-*-linux-.AppImage.zsync` +(appimagetool `-u`), and `package.sh` writes the matching `.zsync` beside it when `zsyncmake` (the +`zsync` package) is installed. [AppImageUpdate](https://github.com/AppImageCommunity/AppImageUpdate) +and AppImageLauncher then download only the changed blocks from the newest published, +non-pre-release release. The job checks both are there. + +**Flatpak.** The `flatpak` jobs (x86_64 on `ubuntu-24.04`, aarch64 on `ubuntu-24.04-arm`) take the +Linux job's tarball and repackage it with `packaging/linux/flatpak-bundle.sh` and +`packaging/linux/flatpak/ai.storyteller.vectorcraft.bundle.yml` into a single-file bundle +(`flatpak install --user vectorcraft--linux-.flatpak`), then install it and run +`vectorcraft-cli --version` in the sandbox. No Rust build happens there, so the bundle carries the +same binaries as the AppImage. `packaging/linux/flatpak/ai.storyteller.vectorcraft.yml` is the +from-source manifest for a Flathub submission (its header says how to build it); packaging-lint +keeps the runtime and sandbox permissions of the two manifests identical. ### FreeBSD @@ -159,8 +176,9 @@ the job fails and asks for a version bump (`cargo xtask version set`). ## Secrets -All jobs run in the `release` environment, which only the `release` branch can use and which holds -the signing secrets. Every secret is optional: a missing one produces unsigned artifacts and a +The jobs that sign (macOS, Windows) and the draft-release job run in the `release` environment, +which only the `release` branch can use and which holds the signing secrets. The other jobs get no +secrets. Every secret is optional: a missing one produces unsigned artifacts and a warning, never a failed build. | Secret | Used for | diff --git a/packaging/linux/flatpak-bundle.sh b/packaging/linux/flatpak-bundle.sh new file mode 100755 index 00000000..bb844193 --- /dev/null +++ b/packaging/linux/flatpak-bundle.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +# Repackage a VectorCraft Linux tarball as a single-file Flatpak bundle: +# +# $DIST/vectorcraft--linux-.flatpak +# +# Usage: packaging/linux/flatpak-bundle.sh [--no-test] [TARBALL] +# +# TARBALL defaults to $DIST/vectorcraft--linux-.tar.gz from package.sh. The bundle +# is built for the host architecture (x86_64 or aarch64), which must match the tarball's. +# Needs flatpak, flatpak-builder and the SVG pixbuf loader (librsvg2-common) for the host's +# `appstreamcli compose`; the freedesktop runtime and SDK named in the manifest are +# installed per-user from Flathub. Unless --no-test, the bundle is then installed per-user and +# `vectorcraft-cli --version` is run inside the sandbox as a smoke test. +# Manifest: packaging/linux/flatpak/ai.storyteller.vectorcraft.bundle.yml. +set -euo pipefail +# shellcheck source=../env.sh +. "$(dirname "${BASH_SOURCE[0]}")/../env.sh" +HERE="$ROOT/packaging/linux" +APP_ID=ai.storyteller.vectorcraft +FLATHUB=https://dl.flathub.org/repo/flathub.flatpakrepo + +TEST=1 +TARBALL="" +while [ $# -gt 0 ]; do + case "$1" in + --no-test) TEST=0; shift ;; + -h | --help) sed -n '2,14p' "$0"; exit 0 ;; + -*) echo "unknown argument: $1" >&2; exit 2 ;; + *) TARBALL="$1"; shift ;; + esac +done + +ARCH="$(uname -m)" +case "$ARCH" in + x86_64) ;; + aarch64 | arm64) ARCH=aarch64 ;; + *) echo "unsupported architecture $ARCH" >&2; exit 2 ;; +esac +BASENAME="vectorcraft-$VERSION-linux-$ARCH" +TARBALL="${TARBALL:-$DIST/$BASENAME.tar.gz}" +[ -f "$TARBALL" ] || { echo "error: $TARBALL not found (run packaging/linux/package.sh --formats tar first)" >&2; exit 1; } +for tool in flatpak flatpak-builder; do + command -v "$tool" >/dev/null || { echo "error: $tool not found (apt install flatpak flatpak-builder librsvg2-common)" >&2; exit 1; } +done + +echo "==> VectorCraft $VERSION Flatpak bundle for $ARCH from $(basename "$TARBALL")" + +WORK="$CARGO_TARGET_DIR/flatpak-bundle" +rm -rf "$WORK" +mkdir -p "$WORK/stage" +tar -xzf "$TARBALL" -C "$WORK/stage" --strip-components=1 +[ -x "$WORK/stage/bin/vectorcraft" ] || { echo "error: $TARBALL has no bin/vectorcraft" >&2; exit 1; } +cp "$HERE/flatpak/$APP_ID.bundle.yml" "$WORK/$APP_ID.yml" + +flatpak remote-add --user --if-not-exists flathub "$FLATHUB" +# --disable-rofiles-fuse: no FUSE in containers and CI runners. +flatpak-builder --user --install-deps-from=flathub --disable-rofiles-fuse --force-clean \ + --default-branch=stable --repo="$WORK/repo" --state-dir="$WORK/state" "$WORK/build" "$WORK/$APP_ID.yml" + +OUT="$DIST/$BASENAME.flatpak" +# --runtime-repo lets `flatpak install` fetch the freedesktop runtime from Flathub if missing. +flatpak build-bundle --runtime-repo="$FLATHUB" "$WORK/repo" "$OUT" "$APP_ID" stable +echo "wrote $OUT" + +if [ "$TEST" = 1 ]; then + flatpak install --user -y --noninteractive --reinstall "$OUT" + flatpak info --user "$APP_ID" + flatpak run --command=vectorcraft-cli "$APP_ID" --version + flatpak run --command=sh "$APP_ID" -c 'ls /app/share/applications /app/share/metainfo /app/share/mime/packages /app/share/icons/hicolor/scalable/apps' +fi +echo "==> done" +ls -lh "$OUT" diff --git a/packaging/linux/flatpak/ai.storyteller.vectorcraft.bundle.yml b/packaging/linux/flatpak/ai.storyteller.vectorcraft.bundle.yml new file mode 100644 index 00000000..36ab122d --- /dev/null +++ b/packaging/linux/flatpak/ai.storyteller.vectorcraft.bundle.yml @@ -0,0 +1,47 @@ +# Flatpak manifest for the single-file bundle attached to every GitHub release +# (vectorcraft--linux-.flatpak). Build it with packaging/linux/flatpak-bundle.sh. +# +# It repackages the release's own Linux tarball (vectorcraft--linux-.tar.gz, +# built on Ubuntu 22.04 by package.sh) instead of compiling Rust inside flatpak-builder: no +# network and no vendored crate sources during the build, a few seconds instead of 20+ minutes, +# and byte-for-byte the same binaries as the AppImage/deb/rpm. The script unpacks the tarball +# into `stage/` next to a copy of this file. The binaries need glibc >= 2.35 and load X11, +# Wayland, xkbcommon and Vulkan at runtime; the freedesktop runtime has all of them, and the +# GPU driver comes from its org.freedesktop.Platform.GL extension. +# +# ai.storyteller.vectorcraft.yml (same directory) is the from-source manifest for Flathub. Keep +# runtime, runtime-version, sdk and finish-args identical in both (packaging-lint checks this). +id: ai.storyteller.vectorcraft +runtime: org.freedesktop.Platform +runtime-version: '25.08' +sdk: org.freedesktop.Sdk +command: vectorcraft +finish-args: + # X11 shared memory (MIT-SHM). Without it the X11 fallback is slow or fails. + - --share=ipc + # Display: Wayland first; X11 only when no Wayland compositor is running. + - --socket=wayland + - --socket=fallback-x11 + # GPU access for the wgpu renderer (Vulkan, or GL as a fallback). + - --device=dri + # Open/Save dialogs use the file-chooser portal (rfd), and drag-and-drop uses the document + # portal, so broad filesystem access isn't needed. Pictures is granted for opening files by + # path from the command line. + - --filesystem=xdg-pictures + # Deliberately not granted: network (the optional --control server listens on 127.0.0.1 in + # the sandbox; `flatpak override --user --share=network ai.storyteller.vectorcraft` exposes it + # to host agents) and home/host filesystem access. +modules: + - name: vectorcraft + buildsystem: simple + build-commands: + - install -Dm755 bin/vectorcraft /app/bin/vectorcraft + - install -Dm755 bin/vectorcraft-cli /app/bin/vectorcraft-cli + - install -Dm644 share/applications/ai.storyteller.vectorcraft.desktop /app/share/applications/ai.storyteller.vectorcraft.desktop + - install -Dm644 share/mime/packages/ai.storyteller.vectorcraft.xml /app/share/mime/packages/ai.storyteller.vectorcraft.xml + # Already has the release's version and date substituted by package.sh. + - install -Dm644 share/metainfo/ai.storyteller.vectorcraft.metainfo.xml /app/share/metainfo/ai.storyteller.vectorcraft.metainfo.xml + - mkdir -p /app/share/icons /app/share/doc && cp -R share/icons/hicolor /app/share/icons/ && cp -R share/doc/vectorcraft /app/share/doc/ + sources: + - type: dir + path: stage diff --git a/packaging/linux/flatpak/ai.storyteller.vectorcraft.yml b/packaging/linux/flatpak/ai.storyteller.vectorcraft.yml index 11038201..91953152 100644 --- a/packaging/linux/flatpak/ai.storyteller.vectorcraft.yml +++ b/packaging/linux/flatpak/ai.storyteller.vectorcraft.yml @@ -8,6 +8,7 @@ # flatpak run ai.storyteller.vectorcraft # # For Flathub, replace the `dir` source with a `git` source pinned to a release tag and commit. +# Release bundles (.flatpak on GitHub Releases) use ai.storyteller.vectorcraft.bundle.yml instead. id: ai.storyteller.vectorcraft runtime: org.freedesktop.Platform runtime-version: '25.08' @@ -16,6 +17,7 @@ sdk-extensions: - org.freedesktop.Sdk.Extension.rust-stable command: vectorcraft finish-args: + # Keep identical to ai.storyteller.vectorcraft.bundle.yml (the release bundle); comments there. - --share=ipc - --socket=wayland - --socket=fallback-x11 diff --git a/packaging/linux/package.sh b/packaging/linux/package.sh index 1644d6a7..1036031f 100755 --- a/packaging/linux/package.sh +++ b/packaging/linux/package.sh @@ -2,6 +2,7 @@ # Build and package VectorCraft for Linux ( is x86_64 or aarch64): # # $DIST/vectorcraft--linux-.AppImage any distro with glibc >= the build host's +# $DIST/vectorcraft--linux-.AppImage.zsync delta updates (needs zsyncmake) # $DIST/vectorcraft--linux-.deb Debian, Ubuntu, Mint, Pop!_OS, ... # $DIST/vectorcraft--linux-.rpm Fedora, openSUSE, RHEL, ... # $DIST/vectorcraft--linux-.tar.gz plain FHS-style tree (bin/, share/) @@ -10,7 +11,8 @@ # # 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, -# glibc 2.35) so the binaries run on newer ones. Optional: desktop-file-validate, appstreamcli. +# glibc 2.35) so the binaries run on newer ones. Optional: desktop-file-validate, appstreamcli, +# zsyncmake (the zsync package) for the AppImage's .zsync. set -euo pipefail # shellcheck source=../env.sh . "$(dirname "${BASH_SOURCE[0]}")/../env.sh" @@ -108,11 +110,29 @@ if has appimage; then chmod +x "$TOOL" fi fi - OUT="$DIST/$BASENAME.AppImage" + # Absolute, because appimagetool runs in $DIST below (CARGO_TARGET_DIR or APPIMAGETOOL may be + # relative, e.g. target/agent-). + OUT="$(cd "$DIST" && pwd)/$BASENAME.AppImage" + APPDIR="$(cd "$APPDIR" && pwd)" + TOOL="$(cd "$(dirname "$TOOL")" && pwd)/$(basename "$TOOL")" + # A .zsync left by an earlier run would hide a missing zsyncmake and describe another file. + rm -f "$OUT.zsync" + # Update information: AppImageUpdate, AppImageLauncher and the like read it from the file and + # fetch only the blocks that changed in a newer release, through the .zsync published next to + # each AppImage on GitHub Releases. `latest` is the newest published release that is not a + # pre-release. A fork's builds point at its own releases through GITHUB_REPOSITORY. + REPO="${GITHUB_REPOSITORY:-storytold/vectorcraft}" + UPDATE_INFO="gh-releases-zsync|${REPO%%/*}|${REPO#*/}|latest|vectorcraft-*-linux-$ARCH.AppImage.zsync" # Extract-and-run: works without FUSE (containers, CI). The output embeds the static runtime, - # so users don't need libfuse2 either. - ARCH="$ARCH" APPIMAGE_EXTRACT_AND_RUN=1 "$TOOL" --no-appstream "$APPDIR" "$OUT" + # so users don't need libfuse2 either. With zsyncmake on the host (CI installs the zsync + # package) appimagetool also writes the .zsync, into its working directory, hence the cd. + (cd "$DIST" && ARCH="$ARCH" APPIMAGE_EXTRACT_AND_RUN=1 "$TOOL" --no-appstream -u "$UPDATE_INFO" "$APPDIR" "$OUT") echo "wrote $OUT" + if [ -s "$OUT.zsync" ]; then + echo "wrote $OUT.zsync" + else + warn "zsyncmake not found, so $OUT.zsync was not written; AppImage delta updates need it" + fi fi "$STAGE/usr/bin/vectorcraft-cli" --version