Move to Gitea: install scripts, links and a release script that builds the DEBs, RPMs, Arch package and a new AppImage
This commit is contained in:
17 files changed
+169
-124
No files matched your search
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
# Builds omaphoto-x86_64.AppImage inside the AppImage image.
|
||||
set -euo pipefail
|
||||
id=io.github.ZacharyZhang_NY.OmaPhoto
|
||||
cmake -S . -B build-appimage -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DOMAPHOTO_BUNDLE_ORT=ON -DOMAPHOTO_MODEL=/usr/local/share/omaphoto/u2net.onnx
|
||||
cmake --build build-appimage --target omaphoto
|
||||
rm -rf AppDir
|
||||
DESTDIR="$PWD/AppDir" cmake --install build-appimage
|
||||
# libheif loads its HEVC decoder as a plugin.
|
||||
mkdir -p AppDir/usr/lib/libheif AppDir/apprun-hooks
|
||||
cp /usr/lib/x86_64-linux-gnu/libheif/plugins/libheif-libde265.so AppDir/usr/lib/libheif/
|
||||
cp packaging/appimage/omaphoto.sh AppDir/apprun-hooks/
|
||||
# Qt's Wayland client needs its shell and decoration plugins.
|
||||
qtplugins=/usr/lib/x86_64-linux-gnu/qt6/plugins
|
||||
mkdir -p AppDir/usr/plugins
|
||||
for dir in wayland-shell-integration wayland-decoration-client wayland-graphics-integration-client; do
|
||||
cp -r "$qtplugins/$dir" AppDir/usr/plugins/
|
||||
done
|
||||
export QMAKE=/usr/lib/qt6/bin/qmake6 APPIMAGE_EXTRACT_AND_RUN=1 OUTPUT=omaphoto-x86_64.AppImage
|
||||
export EXTRA_PLATFORM_PLUGINS="libqwayland-egl.so;libqwayland-generic.so" EXTRA_QT_MODULES=svg
|
||||
linuxdeploy --appdir AppDir --plugin qt --output appimage \
|
||||
--desktop-file "AppDir/usr/share/applications/$id.desktop" \
|
||||
--icon-file "AppDir/usr/share/icons/hicolor/512x512/apps/$id.png" \
|
||||
--deploy-deps-only AppDir/usr/lib/libheif \
|
||||
--deploy-deps-only AppDir/usr/plugins/wayland-shell-integration \
|
||||
--deploy-deps-only AppDir/usr/plugins/wayland-decoration-client \
|
||||
--deploy-deps-only AppDir/usr/plugins/wayland-graphics-integration-client
|
||||
@@ -0,0 +1,10 @@
|
||||
# The dev image plus linuxdeploy, pinned by checksum.
|
||||
ARG DEV=omaphoto-dev
|
||||
FROM $DEV
|
||||
RUN curl -fsSL -o /usr/local/bin/linuxdeploy \
|
||||
https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20251107-1/linuxdeploy-x86_64.AppImage \
|
||||
&& curl -fsSL -o /usr/local/bin/linuxdeploy-plugin-qt \
|
||||
https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/1-alpha-20250213-1/linuxdeploy-plugin-qt-x86_64.AppImage \
|
||||
&& echo "c20cd71e3a4e3b80c3483cef793cda3f4e990aca14014d23c544ca3ce1270b4d /usr/local/bin/linuxdeploy" | sha256sum -c - \
|
||||
&& echo "15106be885c1c48a021198e7e1e9a48ce9d02a86dd0a1848f00bdbf3c1c92724 /usr/local/bin/linuxdeploy-plugin-qt" | sha256sum -c - \
|
||||
&& chmod +x /usr/local/bin/linuxdeploy /usr/local/bin/linuxdeploy-plugin-qt
|
||||
@@ -1,7 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Installs OmaPhoto's latest package on Arch and Omarchy.
|
||||
# Installs OmaPhoto's newest package on Arch and Omarchy.
|
||||
set -euo pipefail
|
||||
base=https://github.com/ZacharyZhang-NY/OmaPhoto/releases/latest/download
|
||||
repo=https://git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto
|
||||
# The newest release's tag, from Gitea's API.
|
||||
tag=$(curl -fsSL --proto '=https' https://git.zacharyzhang.com/api/v1/repos/ZacharyZhang-NY/OmaPhoto/releases/latest | grep -o '"tag_name":"v[^"]*"' | cut -d'"' -f4) || tag=
|
||||
if [ -z "$tag" ]; then
|
||||
echo "No release found at $repo/releases." >&2
|
||||
exit 1
|
||||
fi
|
||||
base=$repo/releases/download/$tag
|
||||
package=omaphoto-x86_64.pkg.tar.zst
|
||||
. /etc/os-release
|
||||
case " ${ID:-} ${ID_LIKE:-} " in
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Installs OmaPhoto's latest RPM on Fedora 43 or 44.
|
||||
# Installs OmaPhoto's newest RPM on Fedora 43 or 44.
|
||||
set -euo pipefail
|
||||
base=https://github.com/ZacharyZhang-NY/OmaPhoto/releases/latest/download
|
||||
repo=https://git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto
|
||||
# The newest release's tag, from Gitea's API.
|
||||
tag=$(curl -fsSL --proto '=https' https://git.zacharyzhang.com/api/v1/repos/ZacharyZhang-NY/OmaPhoto/releases/latest | grep -o '"tag_name":"v[^"]*"' | cut -d'"' -f4) || tag=
|
||||
if [ -z "$tag" ]; then
|
||||
echo "No release found at $repo/releases." >&2
|
||||
exit 1
|
||||
fi
|
||||
base=$repo/releases/download/$tag
|
||||
. /etc/os-release
|
||||
release=
|
||||
case " ${ID:-} ${ID_LIKE:-} " in
|
||||
|
||||
@@ -9,14 +9,11 @@ if [ "$(uname -m)" != x86_64 ]; then
|
||||
echo "OmaPhoto's flake builds for x86_64 alone." >&2
|
||||
exit 1
|
||||
fi
|
||||
# The newest release's tag, as GitHub redirects to it.
|
||||
latest=$(curl -fsSLI --proto '=https' -o /dev/null -w '%{url_effective}' https://github.com/ZacharyZhang-NY/OmaPhoto/releases/latest)
|
||||
tag=${latest##*/}
|
||||
case "$tag" in
|
||||
v[0-9]*) ;;
|
||||
*)
|
||||
echo "No release found at $latest." >&2
|
||||
repo=https://git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto
|
||||
# The newest release's tag, from Gitea's API.
|
||||
tag=$(curl -fsSL --proto '=https' https://git.zacharyzhang.com/api/v1/repos/ZacharyZhang-NY/OmaPhoto/releases/latest | grep -o '"tag_name":"v[^"]*"' | cut -d'"' -f4) || tag=
|
||||
if [ -z "$tag" ]; then
|
||||
echo "No release found at $repo/releases." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
nix --extra-experimental-features "nix-command flakes" profile install "github:ZacharyZhang-NY/OmaPhoto/$tag"
|
||||
fi
|
||||
nix --extra-experimental-features "nix-command flakes" profile install "git+$repo?ref=refs/tags/$tag"
|
||||
@@ -1,7 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Installs OmaPhoto's latest DEB on Ubuntu LTS and derivatives.
|
||||
# Installs OmaPhoto's newest DEB on Ubuntu LTS and derivatives.
|
||||
set -euo pipefail
|
||||
base=https://github.com/ZacharyZhang-NY/OmaPhoto/releases/latest/download
|
||||
repo=https://git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto
|
||||
# The newest release's tag, from Gitea's API.
|
||||
tag=$(curl -fsSL --proto '=https' https://git.zacharyzhang.com/api/v1/repos/ZacharyZhang-NY/OmaPhoto/releases/latest | grep -o '"tag_name":"v[^"]*"' | cut -d'"' -f4) || tag=
|
||||
if [ -z "$tag" ]; then
|
||||
echo "No release found at $repo/releases." >&2
|
||||
exit 1
|
||||
fi
|
||||
base=$repo/releases/download/$tag
|
||||
. /etc/os-release
|
||||
# Each DEB names its LTS's libraries; derivatives name their base.
|
||||
case "${UBUNTU_CODENAME:-}" in
|
||||
|
||||
Executable
+76
@@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env bash
|
||||
# Builds a tag's packages and publishes a Gitea release.
|
||||
set -euo pipefail
|
||||
tag=${1:?"usage: GITEA_TOKEN=... scripts/release.sh vX.Y.Z"}
|
||||
token=${GITEA_TOKEN:?"GITEA_TOKEN must hold a Gitea access token"}
|
||||
api=https://git.zacharyzhang.com/api/v1/repos/ZacharyZhang-NY/OmaPhoto
|
||||
repo=$(cd "$(dirname "$0")/.." && pwd)
|
||||
cd "$repo"
|
||||
version=${tag#v}
|
||||
# The tag must name the version each build file carries.
|
||||
if ! git show "$tag:CMakeLists.txt" | grep -qF "project(omaphoto VERSION $version "; then
|
||||
echo "CMakeLists.txt at $tag is not $version" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! git show "$tag:packaging/arch/PKGBUILD" | grep -qxF "pkgver=$version"; then
|
||||
echo "The PKGBUILD at $tag is not $version" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! git show "$tag:flake.nix" | grep -qF "version = \"$version\";"; then
|
||||
echo "flake.nix at $tag is not $version" >&2
|
||||
exit 1
|
||||
fi
|
||||
out=$repo/release/$tag
|
||||
rm -rf "$out"
|
||||
mkdir -p "$out"
|
||||
work=$(mktemp -d)
|
||||
trap 'rm -rf "$work"' EXIT
|
||||
user="$(id -u):$(id -g)"
|
||||
configure="cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DOMAPHOTO_BUNDLE_ORT=ON -DOMAPHOTO_MODEL=/usr/local/share/omaphoto/u2net.onnx && cmake --build build --target omaphoto"
|
||||
# Each package builds from a fresh copy of the tag.
|
||||
fresh() {
|
||||
rm -rf "$work/src"
|
||||
mkdir "$work/src"
|
||||
git archive "$tag" | tar -x -C "$work/src"
|
||||
}
|
||||
build() {
|
||||
docker run --rm -u "$user" -e HOME=/tmp -v "$work/src:/src" -w /src "$1" sh -c "$2"
|
||||
}
|
||||
# One DEB per Ubuntu LTS: each names its own libraries.
|
||||
docker build -t omaphoto-dev --build-arg BASE=ubuntu:24.04 -f Dockerfile.dev .
|
||||
docker build -t omaphoto-resolute --build-arg BASE=ubuntu:26.04 -f Dockerfile.dev .
|
||||
for pair in noble:omaphoto-dev resolute:omaphoto-resolute; do
|
||||
fresh
|
||||
build "${pair#*:}" "$configure && cd build && cpack -G DEB"
|
||||
mv "$work"/src/build/omaphoto_*.deb "$out/omaphoto-${pair%%:*}_amd64.deb"
|
||||
done
|
||||
# One RPM per Fedora release: each names its own LibRaw.
|
||||
docker build -t omaphoto-fedora --build-arg RELEASE=43 scripts/distro/fedora
|
||||
docker build -t omaphoto-fedora44 --build-arg RELEASE=44 scripts/distro/fedora
|
||||
for pair in 43:omaphoto-fedora 44:omaphoto-fedora44; do
|
||||
fresh
|
||||
build "${pair#*:}" "$configure && cd build && cpack -G RPM"
|
||||
mv "$work"/src/build/omaphoto-*.x86_64.rpm "$out/omaphoto-fc${pair%%:*}.x86_64.rpm"
|
||||
done
|
||||
# makepkg refuses root; a user of our id builds.
|
||||
docker build --pull -t omaphoto-arch scripts/distro/arch
|
||||
fresh
|
||||
docker run --rm -v "$work/src:/src" omaphoto-arch sh -c "useradd -u $(id -u) builder && chown -R builder /src && su builder -c 'cd /src/packaging/arch && makepkg -f'"
|
||||
mv "$work"/src/packaging/arch/omaphoto-[0-9]*-x86_64.pkg.tar.zst "$out/omaphoto-x86_64.pkg.tar.zst"
|
||||
# The AppImage builds on Ubuntu 24.04, the oldest glibc here.
|
||||
docker build -t omaphoto-appimage --build-arg DEV=omaphoto-dev scripts/distro/appimage
|
||||
fresh
|
||||
build omaphoto-appimage scripts/appimage.sh
|
||||
mv "$work/src/omaphoto-x86_64.AppImage" "$out/"
|
||||
names="omaphoto-noble_amd64.deb omaphoto-resolute_amd64.deb omaphoto-fc43.x86_64.rpm omaphoto-fc44.x86_64.rpm omaphoto-x86_64.pkg.tar.zst omaphoto-x86_64.AppImage"
|
||||
(cd "$out" && sha256sum $names > SHA256SUMS)
|
||||
# The tag must already be on Gitea.
|
||||
notes="Install with the script for your system, or run the AppImage: see the README's Install section."
|
||||
body=$(printf '{"tag_name":"%s","name":"OmaPhoto %s","body":"%s"}' "$tag" "$version" "$notes")
|
||||
release=$(curl -fsS -X POST -H "Authorization: token $token" -H "Content-Type: application/json" -d "$body" "$api/releases")
|
||||
id=$(echo "$release" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||
for name in $names SHA256SUMS; do
|
||||
echo "Uploading $name"
|
||||
curl -fsS -o /dev/null -X POST -H "Authorization: token $token" -F "attachment=@$out/$name" "$api/releases/$id/assets?name=$name"
|
||||
done
|
||||
echo "Published https://git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto/releases/tag/$tag"
|
||||
Reference in new issue
Block a user