Add flatpak packaging

This commit is contained in:
Jeena 2025-06-09 23:03:08 +09:00
parent b0582b7781
commit 382cc39b80
4 changed files with 170 additions and 0 deletions

4
.gitignore vendored
View file

@ -12,3 +12,7 @@ src/recoder.egg-info/
*.gresource
*.compiled
packaging/flatpack/build-dir
.flatpak-builder
repo/

View file

@ -0,0 +1,42 @@
app-id: net.jeena.Recoder
runtime: org.gnome.Platform
runtime-version: "48"
sdk: org.gnome.Sdk
command: recoder
finish-args:
- --filesystem=home
- --filesystem=/mnt
- --filesystem=/media
- --filesystem=/run/media
- --filesystem=xdg-data/sounds:ro
- --filesystem=~/.local/share/sounds/recoder:ro
- --socket=wayland
- --socket=x11
- --socket=pulseaudio
- --talk-name=org.freedesktop.Notifications
- --env=GSETTINGS_SCHEMA_DIR=/app/share/glib-2.0/schemas
- --device=dri
add-extensions:
org.freedesktop.Platform.ffmpeg-full:
version: "24.08"
directory: lib/ffmpeg
add-ld-path: .
modules:
- name: recoder
buildsystem: simple
builddir: true
sources:
- type: dir
path: ../../
build-commands:
- glib-compile-resources src/resources/resources.xml --target=src/recoder/resources.gresource --sourcedir=src/resources
- pip3 install --prefix=/app --no-deps --no-build-isolation .
- install -Dm644 src/resources/net.jeena.Recoder.desktop /app/share/applications/net.jeena.Recoder.desktop
- install -Dm644 src/resources/net.jeena.Recoder.svg /app/share/icons/hicolor/scalable/apps/net.jeena.Recoder.svg
- install -Dm644 src/resources/net.jeena.recoder.gschema.xml /app/share/glib-2.0/schemas/net.jeena.recoder.gschema.xml
- install -Dm644 src/resources/complete.oga /app/share/sounds/complete.oga
- install -Dm644 src/resources/net.jeena.Recoder.metainfo.xml /app/share/metainfo/net.jeena.Recoder.metainfo.xml
- glib-compile-schemas /app/share/glib-2.0/schemas

View file

@ -0,0 +1,68 @@
#!/usr/bin/env bash
set -euo pipefail
APP_ID="net.jeena.Recoder"
MANIFEST="${APP_ID}.yaml"
REPO_DIR="repo"
BRANCH="gh-pages"
WORKTREE_DIR="../../gh-pages"
PUBLISH_SUBDIR="flatpak-repo"
GPG_KEY_ID="1DF6570C929E2C186685046F0D6A8E36B9EE6177"
# Clean previous build
rm -rf build-dir "${REPO_DIR}"
# Build Flatpak and create signed repo
flatpak-builder --force-clean \
--repo="${REPO_DIR}" \
--default-branch=stable \
--gpg-sign="${GPG_KEY_ID}" \
build-dir "${MANIFEST}"
# Export public key into repo (also used below for flatpakref)
gpg --export --armor "${GPG_KEY_ID}" > "${REPO_DIR}/gpg.key"
# Clean up existing worktree if any
if [ -d "${WORKTREE_DIR}" ]; then
echo "Removing existing worktree at ${WORKTREE_DIR}..."
git worktree remove --force "${WORKTREE_DIR}"
rm -rf "${WORKTREE_DIR}"
fi
# Prepare gh-pages worktree
git fetch origin "${BRANCH}" || true
git worktree add -B "${BRANCH}" "${WORKTREE_DIR}" "origin/${BRANCH}"
# Clear just the publish subdir inside the worktree
rm -rf "${WORKTREE_DIR:?}/${PUBLISH_SUBDIR}"
mkdir -p "${WORKTREE_DIR}/${PUBLISH_SUBDIR}"
# Copy repo files into the publish subdir
cp -r "${REPO_DIR}/"* "${WORKTREE_DIR}/${PUBLISH_SUBDIR}/"
# Generate .flatpakref inside worktree root
cat > "${WORKTREE_DIR}/${APP_ID}.flatpakref" <<EOF
[Flatpak Ref]
Title=Recoder
Name=${APP_ID}
Branch=stable
Url=https://jeena.github.io/recoder/${PUBLISH_SUBDIR}
IsRuntime=false
RuntimeRepo=https://flathub.org/repo/flathub.flatpakrepo
GPGKey=$(base64 -w0 < "${REPO_DIR}/gpg.key")
EOF
# Get version
VERSION=$(python3 -c 'import toml; print(toml.load("../../pyproject.toml")["project"]["version"])')
# Commit and push only the publish subdir and flatpakref
pushd "${WORKTREE_DIR}" > /dev/null
git add "${PUBLISH_SUBDIR}" "${APP_ID}.flatpakref"
git commit -m "Update Flatpak release to version ${VERSION}" || echo "No changes to commit"
git push origin "${BRANCH}"
popd > /dev/null
# Clean up worktree
git worktree remove "${WORKTREE_DIR}"
echo "✅ Release uploaded to GitHub Pages with GPG signing!"

View file

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>net.jeena.Recoder</id>
<name>Recoder</name>
<summary>Batch video transcoder</summary>
<description>
<p>
Recoder is a simple and efficient GUI tool for batch video transcoding.
It supports drag-and-drop, presets, progress tracking, and more.
</p>
</description>
<screenshots>
<screenshot type="default">
<image>https://raw.githubusercontent.com/jeena/recoder/refs/heads/main/docs/screenshot-1.png</image>
</screenshot>
<screenshot>
<image>https://raw.githubusercontent.com/jeena/recoder/refs/heads/main/docs/screenshot-2.png</image>
</screenshot>
<screenshot>
<image>https://raw.githubusercontent.com/jeena/recoder/refs/heads/main/docs/screenshot-3.png</image>
</screenshot>
<screenshot>
<image>https://raw.githubusercontent.com/jeena/recoder/refs/heads/main/docs/screenshot-4.png</image>
</screenshot>
</screenshots>
<launchable type="desktop-id">net.jeena.Recoder.desktop</launchable>
<developer_name>Jeena Paradies</developer_name>
<project_license>GPL-3.0-or-later</project_license>
<metadata_license>CC0-1.0</metadata_license>
<url type="homepage">https://github.com/jeena/recoder</url>
<url type="bugtracker">https://github.com/jeena/recoder/issues</url>
<url type="help">https://github.com/jeena/recoder/blob/main/docs/HELP.md</url>
<content_rating type="oars-1.1">
<content_attribute id="violence">none</content_attribute>
<content_attribute id="language">none</content_attribute>
<content_attribute id="sex">none</content_attribute>
<content_attribute id="drugs">none</content_attribute>
<content_attribute id="money">none</content_attribute>
<content_attribute id="gambling">none</content_attribute>
<content_attribute id="user_interaction">none</content_attribute>
<content_attribute id="data_sharing">none</content_attribute>
</content_rating>
<releases>
<release version="1.0.0" date="2025-06-09">
<description>
<p>Initial release of Recoder.</p>
</description>
</release>
</releases>
</component>