|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Rebuild + publish the self-hosted, GPG-signed LinuxPop Flatpak repo to GitHub |
| 3 | +# Pages (https://gaimsdevsoftware.github.io/linuxpop-flatpak/). Run this after |
| 4 | +# bumping the version / tagging a release. Idempotent. |
| 5 | +# |
| 6 | +# bash packaging/flatpak/publish-flatpak-repo.sh |
| 7 | +# |
| 8 | +set -euo pipefail |
| 9 | + |
| 10 | +KEYID="FEFAC70C5476018C5FE9A6D7E0075894590EE5D4" # repo signing key |
| 11 | +GNUPGHOME_DIR="$HOME/.config/linuxpop-flatpak-gpg" # <- BACK THIS UP |
| 12 | +REPO="$HOME/linuxpop-flatpak-repo" # local ostree repo |
| 13 | +PAGES="$HOME/linuxpop-flatpak" # local clone of the Pages repo |
| 14 | +PAGES_REMOTE="https://github.com/GaimsDevSoftware/linuxpop-flatpak.git" |
| 15 | +MANIFEST="$(cd "$(dirname "$0")" && pwd)/io.github.GaimsDevSoftware.LinuxPop.yml" |
| 16 | +APPID="io.github.GaimsDevSoftware.LinuxPop" |
| 17 | +export GNUPGHOME="$GNUPGHOME_DIR" |
| 18 | + |
| 19 | +command -v rsync >/dev/null || { echo "need rsync"; exit 1; } |
| 20 | +gpg --list-secret-keys "$KEYID" >/dev/null 2>&1 || { echo "signing key $KEYID not found in $GNUPGHOME_DIR"; exit 1; } |
| 21 | + |
| 22 | +echo "[1/5] building signed repo from $MANIFEST ..." |
| 23 | +flatpak run org.flatpak.Builder --force-clean --ccache \ |
| 24 | + --repo="$REPO" --gpg-sign="$KEYID" --gpg-homedir="$GNUPGHOME_DIR" \ |
| 25 | + --default-branch=stable "$HOME/.cache/linuxpop-publish-build" "$MANIFEST" |
| 26 | + |
| 27 | +echo "[2/5] updating repo metadata + static deltas ..." |
| 28 | +flatpak build-update-repo --gpg-sign="$KEYID" --gpg-homedir="$GNUPGHOME_DIR" \ |
| 29 | + --generate-static-deltas "$REPO" |
| 30 | + |
| 31 | +echo "[3/5] syncing into Pages clone ..." |
| 32 | +[ -d "$PAGES/.git" ] || git clone "$PAGES_REMOTE" "$PAGES" |
| 33 | +mkdir -p "$PAGES/repo" |
| 34 | +rsync -a --delete "$REPO/" "$PAGES/repo/" |
| 35 | +touch "$PAGES/.nojekyll" |
| 36 | + |
| 37 | +echo "[4/5] commit + push Pages ..." |
| 38 | +git -C "$PAGES" config user.name "$(git -C "$HOME/src/linuxpop" config user.name)" |
| 39 | + git -C "$PAGES" config user.email "$(git -C "$HOME/src/linuxpop" config user.email)" |
| 40 | + git -C "$PAGES" add -A |
| 41 | +git -C "$PAGES" commit -m "Update Flatpak repo ($(git -C "$(dirname "$MANIFEST")/../.." describe --tags --always 2>/dev/null || echo update))" \ |
| 42 | + && git -C "$PAGES" push || echo " (nothing to push)" |
| 43 | + |
| 44 | +echo "[5/5] single-file bundle (attach to a GitHub Release) ..." |
| 45 | +flatpak build-bundle --gpg-sign="$KEYID" --gpg-homedir="$GNUPGHOME_DIR" \ |
| 46 | + --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo \ |
| 47 | + "$REPO" "/tmp/${APPID}.flatpak" "$APPID" stable |
| 48 | +echo " bundle: /tmp/${APPID}.flatpak" |
| 49 | +echo |
| 50 | +echo "done. Users install with:" |
| 51 | +echo " flatpak install --from https://gaimsdevsoftware.github.io/linuxpop-flatpak/linuxpop.flatpakref" |
0 commit comments