zed/script/flatpak/bundle-flatpak
Aidan Harris 73d7f70ff6
Flatpak fixes (#14083)
The Flatpak was failing to build because of AppStream metadata linting
errors. It also complained about the hyphen in the cid.

Release Notes:
 
     * N/A
2024-07-10 12:51:08 -06:00

47 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/../.."
shopt -s extglob
script/bundle-linux
archive_match="zed(-[a-zA-Z0-9]+)?-linux-$(uname -m)\.tar\.gz"
archive=$(ls "target/release" | grep -E ${archive_match})
channel=$(<crates/zed/RELEASE_CHANNEL)
export CHANNEL="$channel"
export ARCHIVE="$archive"
if [[ "$channel" == "dev" ]]; then
export APP_ID="dev.zed.ZedDev"
export APP_NAME="Zed Devel"
export BRANDING_LIGHT="#99c1f1"
export BRANDING_DARK="#1a5fb4"
export ICON_FILE="app-icon-dev"
elif [[ "$channel" == "nightly" ]]; then
export APP_ID="dev.zed.ZedNightly"
export APP_NAME="Zed Nightly"
export BRANDING_LIGHT="#e9aa6a"
export BRANDING_DARK="#1a5fb4"
export ICON_FILE="app-icon-nightly"
elif [[ "$channel" == "preview" ]]; then
export APP_ID="dev.zed.ZedPreview"
export APP_NAME="Zed Preview"
export BRANDING_LIGHT="#99c1f1"
export BRANDING_DARK="#1a5fb4"
export ICON_FILE="app-icon-preview"
elif [[ "$channel" == "stable" ]]; then
export APP_ID="dev.zed.Zed"
export APP_NAME="Zed"
export BRANDING_LIGHT="#99c1f1"
export BRANDING_DARK="#1a5fb4"
export ICON_FILE="app-icon"
else
echo "Invalid channel: '$channel'"
exit
fi
envsubst < "crates/zed/resources/flatpak/manifest-template.json" > "$APP_ID.json"
flatpak-builder --user --install --force-clean build "$APP_ID.json"
flatpak build-bundle ~/.local/share/flatpak/repo "target/release/$APP_ID.flatpak" "$APP_ID"
echo "Created 'target/release/$APP_ID.flatpak'"