diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8dfa459..209a80e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,6 +69,13 @@ jobs: if: runner.os == 'macOS' run: rustup target add x86_64-apple-darwin - run: npx tauri build ${{ matrix.args }} + - name: Update information in the AppImage + # So AppImageUpdate and similar tools can update it from the latest release. + if: runner.os == 'Linux' + run: | + curl -fsSL -o "$RUNNER_TEMP/appimagetool" https://github.com/AppImage/appimagetool/releases/download/1.9.1/appimagetool-x86_64.AppImage + chmod +x "$RUNNER_TEMP/appimagetool" + APPIMAGETOOL="$RUNNER_TEMP/appimagetool" packaging/appimage-update-info.sh target/release/bundle/appimage/VeloPopuli_*_amd64.AppImage - name: Relay server run: cargo build --release -p velopopuli-relay - uses: actions/upload-artifact@v4 @@ -80,6 +87,7 @@ jobs: target/release/bundle/**/*-setup.exe target/release/bundle/**/*.deb target/release/bundle/**/*.AppImage + target/release/bundle/**/*.AppImage.zsync target/release/velopopuli-relay target/release/velopopuli-relay.exe if-no-files-found: warn @@ -145,7 +153,7 @@ jobs: - name: Collect the files run: | mkdir out - find artifacts -type f \( -name '*.dmg' -o -name '*.msi' -o -name '*-setup.exe' -o -name '*.deb' -o -name '*.AppImage' -o -name '*.pkg.tar.zst' -o -name 'PKGBUILD' \) -exec cp {} out/ \; + find artifacts -type f \( -name '*.dmg' -o -name '*.msi' -o -name '*-setup.exe' -o -name '*.deb' -o -name '*.AppImage' -o -name '*.AppImage.zsync' -o -name '*.pkg.tar.zst' -o -name 'PKGBUILD' \) -exec cp {} out/ \; # The relay has the same name on every system; tell them apart. relay() { find "artifacts/VeloPopuli-$1" -type f -name "$2" | head -1; } cp "$(relay macOS velopopuli-relay)" out/velopopuli-relay-macos-arm64 diff --git a/docs/developers/releasing.md b/docs/developers/releasing.md index fcf68b1..17604fb 100644 --- a/docs/developers/releasing.md +++ b/docs/developers/releasing.md @@ -44,10 +44,17 @@ The `release` job in [`build.yml`](../../.github/workflows/build.yml) collects t | `VeloPopuli_X.Y.Z_universal.dmg` | macOS, Apple silicon and Intel | | `VeloPopuli_X.Y.Z_x64_en-US.msi`, `VeloPopuli_X.Y.Z_x64-setup.exe` | Windows | | `VeloPopuli_X.Y.Z_amd64.deb`, `VeloPopuli_X.Y.Z_amd64.AppImage` | Linux | +| `VeloPopuli_X.Y.Z_amd64.AppImage.zsync` | Updating the AppImage (below) | | `velopopuli-bin-X.Y.Z-1-x86_64.pkg.tar.zst`, `PKGBUILD` | Arch Linux | | `velopopuli-relay-macos-arm64`, `-linux-x86_64`, `-windows-x86_64.exe` | The group-ride relay | | `SHA256SUMS.txt` | Checksums of all of the above | +### Updating the AppImage + +The AppImage carries update information, so [AppImageUpdate](https://github.com/AppImageCommunity/AppImageUpdate) and tools like it can update an installed copy from the latest release, downloading only what changed. After `tauri build`, the Linux job runs [`packaging/appimage-update-info.sh`](../../packaging/appimage-update-info.sh), which unpacks the AppImage, packs it again with [appimagetool](https://github.com/AppImage/appimagetool) and `-u "gh-releases-zsync|pepperstm|velopopuli|latest|VeloPopuli_*_amd64.AppImage.zsync"`, and checks the result. The `.zsync` file it makes is published with the release. `latest` means pre-releases are never offered as updates. + +VeloPopuli is also listed in the [AppImage catalog](https://appimage.github.io), which reads the newest release from GitHub itself. + ### Signing - **macOS** builds are ad-hoc signed (`signingIdentity: "-"`, hardened runtime off), not notarised. The first launch needs *Open Anyway* in System Settings → Privacy & Security. A Developer ID certificate and notarisation would remove that. diff --git a/docs/wiki/Installing.md b/docs/wiki/Installing.md index 5b3e17e..cd02d92 100644 --- a/docs/wiki/Installing.md +++ b/docs/wiki/Installing.md @@ -21,6 +21,7 @@ For an ANT+ stick, Windows needs the generic WinUSB driver — see [[Connecting - **Ubuntu, Debian, Mint, Pop!_OS…:** `sudo apt install ./VeloPopuli__amd64.deb` - **Arch, Manjaro, EndeavourOS…:** `sudo pacman -U velopopuli-bin--x86_64.pkg.tar.zst` (the `PKGBUILD` is attached to the release too) - **Anything else:** make the `.AppImage` executable and run it. + To update it later, use [AppImageUpdate](https://github.com/AppImageCommunity/AppImageUpdate) (from version 0.3.11): it fetches the latest release and downloads only what has changed. Bluetooth needs BlueZ running. The `.deb` installs the rule that lets you use an ANT+ stick without root; with the AppImage, add it yourself (see [[Connecting your trainer]]). > The Windows and Linux versions have had less use than the Mac one so far. If something goes wrong, please [[tell us|Reporting problems]]. diff --git a/packaging/RELEASE_NOTES.md b/packaging/RELEASE_NOTES.md index 0b33136..b7daa0a 100644 --- a/packaging/RELEASE_NOTES.md +++ b/packaging/RELEASE_NOTES.md @@ -22,7 +22,7 @@ | **Windows** 10/11 (64-bit) | `VeloPopuli_*_x64-setup.exe` or `VeloPopuli_*_x64_en-US.msi` | Not code-signed yet: if SmartScreen warns, choose **More info → Run anyway**. ANT+ sticks need the WinUSB driver ([Zadig](https://zadig.akeo.ie)). | | **Ubuntu / Debian** (and Mint, Pop!_OS…; 64-bit) | `VeloPopuli_*_amd64.deb` | `sudo apt install ./VeloPopuli_*_amd64.deb` — installs the ANT+ stick permission rule too. | | **Arch Linux** (and Manjaro, EndeavourOS…) | `velopopuli-bin-*-x86_64.pkg.tar.zst` | `sudo pacman -U velopopuli-bin-*.pkg.tar.zst`. The `PKGBUILD` is attached too. Install `bluez` for Bluetooth. | -| **Any other Linux** (64-bit) | `VeloPopuli_*_amd64.AppImage` | `chmod +x` and run. | +| **Any other Linux** (64-bit) | `VeloPopuli_*_amd64.AppImage` | `chmod +x` and run. Later versions can be installed with AppImageUpdate, which downloads only what has changed. | **Group-ride relay** (optional, for hosting rides with friends): `velopopuli-relay-*` for macOS, Windows and Linux — see [Group rides and self-hosting](https://github.com/pepperstm/velopopuli/wiki/Group-rides-and-self-hosting). diff --git a/packaging/appimage-update-info.sh b/packaging/appimage-update-info.sh new file mode 100755 index 0000000..4d390b9 --- /dev/null +++ b/packaging/appimage-update-info.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# Embeds update information in the AppImage and writes its .zsync file next to it, so +# AppImageUpdate and similar tools can update it from the latest GitHub release. +# +# packaging/appimage-update-info.sh target/release/bundle/appimage/VeloPopuli_X.Y.Z_amd64.AppImage +# +# Needs appimagetool (APPIMAGETOOL=path, default `appimagetool` on the PATH). The AppImage is +# unpacked and packed again with the same contents; only the update information is added. +set -euo pipefail + +appimage=$(realpath "$1") +tool=${APPIMAGETOOL:-appimagetool} +# Only full releases: "latest" skips pre-releases such as 0.4.0-beta.1. +info="gh-releases-zsync|pepperstm|velopopuli|latest|VeloPopuli_*_amd64.AppImage.zsync" + +work=$(mktemp -d) +trap 'rm -rf "$work"' EXIT +cd "$work" +"$appimage" --appimage-extract >/dev/null +mkdir out +# The .zsync names the AppImage it describes, so it's built under the final name. Built +# from inside `out`, since appimagetool writes the .zsync to the folder it runs in. +name=$(basename "$appimage") +(cd out && ARCH=x86_64 APPIMAGE_EXTRACT_AND_RUN=1 "$tool" --no-appstream -u "$info" ../squashfs-root "$name") +out="out/$name" + +test -s "$out.zsync" || { echo "appimagetool made no .zsync file:" >&2; find "$work" -maxdepth 2 -name '*.zsync' >&2; exit 1; } +embedded=$("$out" --appimage-updateinformation) +if [ "$embedded" != "$info" ]; then + echo "update information not embedded: got '$embedded'" >&2 + exit 1 +fi + +mv -f "$out" "$appimage" +mv -f "$out.zsync" "$appimage.zsync" +chmod +x "$appimage" +echo "Update information: $info" +ls -la "$appimage" "$appimage.zsync"