fix(packaging): align Linux nightly tarball and Arch handoff and re-enable all 6 Linux formats (#4888)

This commit is contained in:
Dylan M. Taylor authored and GitHub committed 2026-11-28 22:51:50 -05:00
1 parent 2d62488dd2
commit e4b6735818
7 files changed
+56 -81

No files matched your search

+8
View File
@@ -93,6 +93,14 @@
},
"linux-x86_64": {
"unsigned_artifact_name": "nightly-unsigned-linux-x86_64",
"package_formats": [
"appimage",
"arch",
"deb",
"flatpak",
"oci",
"rpm"
],
"trust": {
"fingerprint": "2B76741B414AAD6CD33E631213A005C0B9D7C3ED"
}
+1
View File
@@ -32,3 +32,4 @@ jobs:
# craft-common-actions main commit that merged the exact-analysis admission (#371, after #370,
# #369 and #364).
platforms: '["windows-x86_64","linux-x86_64","macos-aarch64"]'
linux-package-formats: '["deb","rpm","appimage","flatpak","oci","arch"]'
+8
View File
@@ -40,6 +40,14 @@
},
"linux-x86_64": {
"unsigned_artifact_name": "nightly-unsigned-linux-x86_64",
"package_formats": [
"appimage",
"arch",
"deb",
"flatpak",
"oci",
"rpm"
],
"trust": {
"fingerprint": "2B76741B414AAD6CD33E631213A005C0B9D7C3ED"
}
+21 -33
View File
@@ -57,20 +57,13 @@ WORK="$CARGO_TARGET_DIR/flatpak-bundle"
rm -rf "$WORK"
mkdir -p "$WORK/stage"
tar -xzf "$TARBALL" -C "$WORK/stage" --strip-components=1
# Stable ships bin/lightcraft; a Nightly tar ships its launchers in bin/ and the real binaries in
# lib/lightcraft-nightly (packaging/linux/package.sh stage_nightly).
[[ -x "$WORK/stage/bin/lightcraft" || -x "$WORK/stage/lib/lightcraft-nightly/lightcraft" ]] \
|| { echo "error: $TARBALL has no LightCraft binary" >&2; exit 1; }
[[ -x "$WORK/stage/bin/lightcraft" && -x "$WORK/stage/bin/lightcraft-cli" ]] \
|| { echo "error: $TARBALL has no bin/lightcraft or bin/lightcraft-cli" >&2; exit 1; }
if [[ "$FLATPAK_ID" != "$APP_ID" ]]; then
gui="$WORK/stage/lib/lightcraft-nightly/lightcraft"
cli="$WORK/stage/lib/lightcraft-nightly/lightcraft-cli"
[[ -x "$gui" && -x "$cli" ]] \
|| { echo "error: $TARBALL is not a Nightly tar (no lib/lightcraft-nightly binaries); pass the -nightly- tarball from package.sh" >&2; exit 1; }
# The bundle installs the real binaries in /app/libexec and its own wrappers in /app/bin: inside
# the sandbox the Nightly Flatpak id isolates the data, and the profile keeps it explicit.
mv "$gui" "$WORK/stage/bin/lightcraft-bin"
mv "$cli" "$WORK/stage/bin/lightcraft-cli-bin"
rm -rf "$WORK/stage/lib" "$WORK/stage/bin/lightcraft-nightly" "$WORK/stage/bin/lightcraft-nightly-cli"
mv "$WORK/stage/bin/lightcraft" "$WORK/stage/bin/lightcraft-bin"
mv "$WORK/stage/bin/lightcraft-cli" "$WORK/stage/bin/lightcraft-cli-bin"
cat >"$WORK/stage/bin/lightcraft" <<'WRAPPER'
#!/bin/sh
set -eu
@@ -92,31 +85,26 @@ if [ -z "${LIGHTCRAFT_LIBRARY+x}" ]; then export LIGHTCRAFT_LIBRARY="$profile/Li
exec /app/libexec/lightcraft-cli "$@"
WRAPPER
chmod 755 "$WORK/stage/bin/lightcraft" "$WORK/stage/bin/lightcraft-cli"
# The tar names the desktop entry, the metainfo, the icon and the doc folder for the *window* id
# (…nightly-v1). The Flatpak id (…nightly) is the artifact id and owns them inside the sandbox;
# StartupWMClass stays on the window id the app really sets.
nightly_id="$APP_ID.nightly-v1"
sed -e "s#^Exec=lightcraft-nightly\([[:space:]]\|$\)#Exec=lightcraft\1#" \
-e "s|^TryExec=lightcraft-nightly$|TryExec=lightcraft|" \
-e "s|^Icon=.*|Icon=$FLATPAK_ID|" \
"$WORK/stage/share/applications/$nightly_id.desktop" >"$WORK/stage/share/applications/$FLATPAK_ID.desktop"
rm -f "$WORK/stage/share/applications/$nightly_id.desktop"
sed -e "s|<id>$nightly_id</id>|<id>$FLATPAK_ID</id>|g" \
-e "s|<launchable type=\"desktop-id\">$nightly_id.desktop</launchable>|<launchable type=\"desktop-id\">$FLATPAK_ID.desktop</launchable>|g" \
-e "s|<icon type=\"stock\">$nightly_id</icon>|<icon type=\"stock\">$FLATPAK_ID</icon>|g" \
"$WORK/stage/share/metainfo/$nightly_id.metainfo.xml" >"$WORK/stage/share/metainfo/$FLATPAK_ID.metainfo.xml"
rm -f "$WORK/stage/share/metainfo/$nightly_id.metainfo.xml"
# Nightly opens no files from the file manager: no MIME database, as in the tar.
# The Flatpak id (…nightly) is the artifact id and owns desktop, metainfo and icon inside the
# sandbox; StartupWMClass stays on the window id (…nightly-v1) the app really sets.
sed -e "s|^Icon=$APP_ID$|Icon=$FLATPAK_ID|" \
-e "s|^Name=LightCraft$|Name=LightCraft Nightly|" \
-e "s|^StartupWMClass=.*|StartupWMClass=$APP_ID.nightly-v1|" \
-e '/^MimeType=/d' \
"$WORK/stage/share/applications/$APP_ID.desktop" >"$WORK/stage/share/applications/$FLATPAK_ID.desktop"
rm -f "$WORK/stage/share/applications/$APP_ID.desktop"
sed -e "s|<id>$APP_ID</id>|<id>$FLATPAK_ID</id>|g" \
-e "s|<name>LightCraft</name>|<name>LightCraft Nightly</name>|g" \
-e "s|<launchable type=\"desktop-id\">$APP_ID.desktop</launchable>|<launchable type=\"desktop-id\">$FLATPAK_ID.desktop</launchable>|g" \
-e "s|<icon type=\"stock\">$APP_ID</icon>|<icon type=\"stock\">$FLATPAK_ID</icon>|g" \
"$WORK/stage/share/metainfo/$APP_ID.metainfo.xml" >"$WORK/stage/share/metainfo/$FLATPAK_ID.metainfo.xml"
rm -f "$WORK/stage/share/metainfo/$APP_ID.metainfo.xml"
# Nightly opens no files from the file manager: no MIME database.
rm -rf "$WORK/stage/share/mime"
nightly_icon="$WORK/stage/share/icons/hicolor/256x256/apps/$nightly_id.png"
[[ -f "$nightly_icon" ]] || nightly_icon="$ROOT/assets/app-icon/lightcraft-nightly.png"
rm -rf "$WORK/stage/share/icons/hicolor"
nightly_icon="$ROOT/assets/app-icon/lightcraft-nightly.png"
[[ -f "$nightly_icon" ]] || nightly_icon="$ROOT/assets/app-icon/hicolor/256x256/apps/$APP_ID.png"
install -Dm644 "$nightly_icon" "$WORK/stage/share/icons/hicolor/256x256/apps/$FLATPAK_ID.png"
rm -f "$WORK/stage/share/icons/hicolor/256x256/apps/$nightly_id.png"
if [[ -d "$WORK/stage/share/doc/lightcraft-nightly" ]]; then
# The manifest copies share/doc/lightcraft (the stable name).
mv "$WORK/stage/share/doc/lightcraft-nightly" "$WORK/stage/share/doc/lightcraft"
fi
sed -e "s|ai\.storyteller\.lightcraft|$FLATPAK_ID|g" \
-e 's|- install -Dm755 bin/lightcraft /app/bin/lightcraft|- install -Dm755 bin/lightcraft-bin /app/libexec/lightcraft\n - install -Dm755 bin/lightcraft /app/bin/lightcraft|' \
-e 's|- install -Dm755 bin/lightcraft-cli /app/bin/lightcraft-cli|- install -Dm755 bin/lightcraft-cli-bin /app/libexec/lightcraft-cli\n - install -Dm755 bin/lightcraft-cli /app/bin/lightcraft-cli|' \
+9 -18
View File
@@ -54,25 +54,16 @@ bin="$work/installed/bin"
mv "$bin/lightcraft" "$bin/lightcraft-nightly"
mv "$bin/lightcraft-cli" "$bin/lightcraft-nightly-cli"
# The packager installs the tree as it is: no stable id may be left to rename.
nightly_id=ai.storyteller.lightcraft.nightly-v1
# Canonical ai.storyteller.lightcraft IDs stay intact so arch-package.sh performs the single
# nightly rename cleanly, while the hicolor icon payload is swapped to the Nightly badge icon.
app_id=ai.storyteller.lightcraft
share="$work/extract/$base/share"
test -f "$share/applications/$nightly_id.desktop"
test ! -e "$share/applications/ai.storyteller.lightcraft.desktop"
grep -qx "StartupWMClass=$nightly_id" "$share/applications/$nightly_id.desktop"
grep -qx "Icon=$nightly_id" "$share/applications/$nightly_id.desktop"
# The installed command is lightcraft-nightly (the stable launcher is renamed by the packager):
# `Exec=lightcraft %F` would start the stable app from the Nightly menu entry, arguments intact.
grep -qx 'Exec=lightcraft-nightly %F' "$share/applications/$nightly_id.desktop"
# `! grep` is not a condition: errexit skips it, so a match would pass. Fail the assertion explicitly.
if grep -q '^MimeType=' "$share/applications/$nightly_id.desktop"; then
echo 'FAIL: the Nightly desktop file still declares MimeType' >&2
exit 1
fi
test -f "$share/metainfo/$nightly_id.metainfo.xml"
grep -q "<id>$nightly_id</id>" "$share/metainfo/$nightly_id.metainfo.xml"
grep -q "<binary>lightcraft-nightly</binary>" "$share/metainfo/$nightly_id.metainfo.xml"
test -f "$share/icons/hicolor/256x256/apps/$nightly_id.png"
test -f "$share/applications/$app_id.desktop"
test ! -e "$share/applications/$app_id.nightly-v1.desktop"
test -f "$share/metainfo/$app_id.metainfo.xml"
test ! -e "$share/metainfo/$app_id.nightly-v1.metainfo.xml"
test -f "$share/icons/hicolor/256x256/apps/$app_id.png"
cmp "$HERE/../../assets/app-icon/lightcraft-nightly.png" "$share/icons/hicolor/256x256/apps/$app_id.png"
test ! -e "$stage/bin/.lightcraft-nightly"
cmp "$stage/bin/lightcraft" "$bin/.lightcraft-nightly/lightcraft"
+5 -26
View File
@@ -18,37 +18,16 @@ cp "$here/nightly-arch-launch.sh" "$stage/bin/lightcraft"
cp "$here/nightly-arch-launch.sh" "$stage/bin/lightcraft-cli"
chmod 755 "$stage/bin/lightcraft" "$stage/bin/lightcraft-cli"
# The packager installs this tree as it is, so the Nightly desktop entry, metainfo and icon are
# named for the Nightly channel here: leaving the stable ids would make them rename three files
# and would collide with a stable install's menu entry.
# Leave share/ at the canonical ai.storyteller.lightcraft IDs so arch-package.sh derives
# ai.storyteller.lightcraft.nightly and performs the nightly renames cleanly without double-suffixing.
# Swap the hicolor icon content to the Nightly badge under the canonical name so arch-package.sh
# renames it to ai.storyteller.lightcraft.nightly.png.
app_id=ai.storyteller.lightcraft
nightly_id="$app_id.nightly-v1"
if [ -f "$stage/share/applications/$app_id.desktop" ]; then
# The packager renames the launchers to lightcraft-nightly(-cli) when it installs this tree, so the
# menu entry must name the installed command: `Exec=lightcraft` would start stable beside it.
sed -e 's#^Exec=lightcraft\([[:space:]]\|$\)#Exec=lightcraft-nightly\1#' \
-e 's#^TryExec=lightcraft$#TryExec=lightcraft-nightly#' \
-e "s|^Icon=$app_id$|Icon=$nightly_id|" \
-e "s|^StartupWMClass=.*|StartupWMClass=$nightly_id|" \
-e "s|^Name=LightCraft$|Name=LightCraft Nightly|" \
-e '/^MimeType=/d' \
"$stage/share/applications/$app_id.desktop" >"$stage/share/applications/$nightly_id.desktop"
rm -f "$stage/share/applications/$app_id.desktop"
fi
if [ -f "$stage/share/metainfo/$app_id.metainfo.xml" ]; then
sed -e "s|<id>$app_id</id>|<id>$nightly_id</id>|g" \
-e "s|<name>LightCraft</name>|<name>LightCraft Nightly</name>|g" \
-e "s|<launchable type=\"desktop-id\">$app_id.desktop</launchable>|<launchable type=\"desktop-id\">$nightly_id.desktop</launchable>|g" \
-e "s|<icon type=\"stock\">$app_id</icon>|<icon type=\"stock\">$nightly_id</icon>|g" \
-e "s|<binary>lightcraft</binary>|<binary>lightcraft-nightly</binary>|g" \
"$stage/share/metainfo/$app_id.metainfo.xml" >"$stage/share/metainfo/$nightly_id.metainfo.xml"
rm -f "$stage/share/metainfo/$app_id.metainfo.xml"
fi
if [ -d "$stage/share/icons/hicolor" ]; then
nightly_icon="$here/../../assets/app-icon/lightcraft-nightly.png"
if [ -f "$nightly_icon" ]; then
rm -rf "$stage/share/icons/hicolor"
install -Dm644 "$nightly_icon" "$stage/share/icons/hicolor/256x256/apps/$nightly_id.png"
install -Dm644 "$nightly_icon" "$stage/share/icons/hicolor/256x256/apps/$app_id.png"
fi
fi
tar -C "$work" -czf "$destination/$basename.tar.gz" "$basename"
+4 -4
View File
@@ -108,10 +108,11 @@ has() {
case " $FORMATS " in *" $format "*) return 0 ;; *) return 1 ;; esac
}
# ---- the Nightly FHS layout (the plain tar and the deb/rpm share it) -----------------------------
# ---- the Nightly FHS layout (used by deb/rpm) ---------------------------------------------------
# The real binaries move to usr/lib/lightcraft-nightly and usr/bin holds launchers: the GUI starts
# through its launch profile, the headless CLI takes the same profile through its two host
# variables. One layout, so an unpacked tar, a .deb and a .rpm all behave the same.
# variables. The plain tar keeps the canonical $STAGE tree for CI's nightly smoke test, Arch
# side-by-side fixture, and Flatpak/OCI staging.
stage_nightly() {
local stage="$WORK/nightly-root" icon
export NFPM_NAME="lightcraft-nightly"
@@ -154,9 +155,8 @@ NIGHTLY_STAGE=""
# ---- .tar.gz ------------------------------------------------------------------------------------
if has tar; then
TAR_SRC="${NIGHTLY_STAGE:-$STAGE}"
mkdir -p "$WORK/tar"
cp -R "$TAR_SRC/usr" "$WORK/tar/$BASENAME"
cp -R "$STAGE/usr" "$WORK/tar/$BASENAME"
tar -C "$WORK/tar" -czf "$DIST/$BASENAME.tar.gz" "$BASENAME"
echo "wrote $DIST/$BASENAME.tar.gz"
fi