diff --git a/packaging/flatpak-site.sh b/packaging/flatpak-site.sh
index b0e963f6..c48bd47d 100644
--- a/packaging/flatpak-site.sh
+++ b/packaging/flatpak-site.sh
@@ -2,12 +2,15 @@
# All Pages deployments include the book, web app, and published Flatpak repository.
# Shared by docs updates and release publication; no other workflow replaces the site.
set -euo pipefail
+trap 'echo "flatpak-site.sh: line $LINENO: \"$BASH_COMMAND\" failed (exit $?)" >&2' ERR
site="${1:?site directory required}"
tag="${RELEASE_TAG:-}"
app_id=ai.storyteller.solidcraft
# Compatibility shim (docs/compatibility.md): releases before 0.8 used this app id. Its refs stay
-# in the repository, marked end-of-life with a rebase to $app_id.
+# in the repository, marked end-of-life with a rebase to $app_id once a release under $app_id
+# has been imported. Until then (the latest release is still from before the rename), the
+# release's bundles carry $legacy_id and are published as they are.
legacy_id=ai.storyteller.solvecraft
if [ -z "$tag" ]; then
tag="$(gh api "repos/$GITHUB_REPOSITORY/releases?per_page=100" \
@@ -49,7 +52,22 @@ for arch in x86_64 aarch64; do
validation_repo="$(mktemp -d)"
ostree --repo="$validation_repo" init --mode=archive-z2
flatpak build-import-bundle "$validation_repo" "$bundles/$asset"
- ostree --repo="$validation_repo" refs | grep -Fxq "app/$app_id/$arch/stable"
+ refs="$(ostree --repo="$validation_repo" refs)"
+ if printf '%s\n' "$refs" | grep -Fxq "app/$app_id/$arch/stable"; then
+ bundle_id=$app_id
+ elif printf '%s\n' "$refs" | grep -Fxq "app/$legacy_id/$arch/stable"; then
+ bundle_id=$legacy_id
+ else
+ echo "error: $asset holds neither app/$app_id/$arch/stable nor app/$legacy_id/$arch/stable; refs:" >&2
+ printf '%s\n' "$refs" >&2
+ exit 1
+ fi
+ if [ -n "${published_id:-}" ] && [ "$published_id" != "$bundle_id" ]; then
+ echo "error: $asset is $bundle_id, but the other architecture's bundle is $published_id" >&2
+ exit 1
+ fi
+ published_id=$bundle_id
+ echo "$asset: app/$bundle_id/$arch/stable"
flatpak build-import-bundle "$repo_dir" "$bundles/$asset"
done
# `flatpak update` then offers existing installs of the old id the move to the new one, and
@@ -58,6 +76,11 @@ done
for arch in x86_64 aarch64; do
legacy_ref="app/$legacy_id/$arch/stable"
ostree --repo="$repo_dir" rev-parse "$legacy_ref" >/dev/null 2>&1 || continue
+ # Only rebase to an app the repository has: a release from before the rename has no new ref.
+ if ! ostree --repo="$repo_dir" rev-parse "app/$app_id/$arch/stable" >/dev/null 2>&1; then
+ echo "$legacy_ref: no app/$app_id/$arch/stable yet, not marked end-of-life"
+ continue
+ fi
if ! ostree --repo="$repo_dir" show --print-metadata-key=ostree.endoflife-rebase "$legacy_ref" >/dev/null 2>&1; then
flatpak build-commit-from --no-update-summary --end-of-life-rebase="$legacy_id=$app_id" \
--src-ref="$legacy_ref" "$repo_dir" "$legacy_ref"
@@ -79,8 +102,8 @@ META
cat >"$site/flatpak/index.html" <
SolidCraft Flatpak repositorySolidCraft Flatpak repository
Latest published release: $tag
Add the SolidCraft repository
Flathub provides the required Freedesktop runtime. Add both remotes to the same user installation:
flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak remote-add --user --if-not-exists solidcraft $base_url/flatpak/solidcraft.flatpakrepo
-flatpak install --user solidcraft $app_id
-flatpak run $app_id
+flatpak install --user solidcraft $published_id
+flatpak run $published_id