mirror of
https://github.com/Heretek-AI/heretek-flathub.git
synced 2026-07-01 15:39:27 -04:00
Add Flatpak CI workflow for drop-app
This commit is contained in:
@@ -0,0 +1,155 @@
|
||||
name: Build Drop Desktop Flatpak
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_tag:
|
||||
description: 'Release tag to build the Flatpak from (leave empty to build from current branch of drop-app)'
|
||||
required: false
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
# Builds the Drop Desktop Flatpak from a pre-built Tauri .deb.
|
||||
#
|
||||
# Strategy:
|
||||
# - On release: downloads the pre-built .deb from release assets,
|
||||
# bundles system tray libraries from apt, and builds the Flatpak.
|
||||
# - On workflow_dispatch without tag: builds the .deb from source
|
||||
# using the latest drop-app commit, then packages it as Flatpak.
|
||||
|
||||
jobs:
|
||||
flatpak-build:
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./packages/drop-app
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Install Flatpak SDK
|
||||
working-directory: .
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y flatpak flatpak-builder
|
||||
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
|
||||
- name: Install GNOME Platform 48
|
||||
working-directory: .
|
||||
run: |
|
||||
flatpak install --system flathub org.gnome.Platform//48 org.gnome.Sdk//48 -y
|
||||
|
||||
- name: Install system tray libraries
|
||||
working-directory: .
|
||||
run: |
|
||||
sudo apt-get install -y \
|
||||
libayatana-appindicator3-dev \
|
||||
libdbusmenu-gtk3-dev
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
run_install: false
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/*
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Rust cache
|
||||
uses: swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: './packages/drop-app/app-src/src-tauri -> target'
|
||||
|
||||
- name: Install system deps for Tauri
|
||||
working-directory: .
|
||||
run: |
|
||||
sudo apt-get install -y \
|
||||
libwebkit2gtk-4.1-dev \
|
||||
librsvg2-dev \
|
||||
patchelf \
|
||||
xdg-utils
|
||||
|
||||
- name: Determine build mode
|
||||
id: build_mode
|
||||
run: |
|
||||
if [[ -n "${{ github.event.inputs.release_tag }}" ]]; then
|
||||
echo "source=release" >> "$GITHUB_OUTPUT"
|
||||
echo "tag=${{ github.event.inputs.release_tag }}" >> "$GITHUB_OUTPUT"
|
||||
elif [[ "${{ github.event_name }}" == "release" ]]; then
|
||||
echo "source=release" >> "$GITHUB_OUTPUT"
|
||||
echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "source=source" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
# ── Mode A: Build from source ──
|
||||
- name: (Source) Clone drop-app
|
||||
if: steps.build_mode.outputs.source == 'source'
|
||||
run: |
|
||||
rm -rf app-src
|
||||
git clone --depth 1 https://github.com/Drop-OSS/drop-app.git app-src
|
||||
|
||||
- name: (Source) Install frontend dependencies
|
||||
if: steps.build_mode.outputs.source == 'source'
|
||||
working-directory: ./packages/drop-app/app-src
|
||||
run: pnpm install
|
||||
|
||||
- name: (Source) Build Tauri .deb
|
||||
if: steps.build_mode.outputs.source == 'source'
|
||||
working-directory: ./packages/drop-app/app-src
|
||||
run: pnpm tauri build --bundles deb
|
||||
|
||||
# ── Mode B: Download from release ──
|
||||
- name: (Release) Download .deb from release
|
||||
if: steps.build_mode.outputs.source == 'release'
|
||||
working-directory: .
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
TAG="${{ steps.build_mode.outputs.tag }}"
|
||||
gh release download "$TAG" \
|
||||
--repo Drop-OSS/drop-app \
|
||||
--pattern '*_amd64.deb' \
|
||||
--dir packages/drop-app/
|
||||
|
||||
# ── Common: Prepare inputs for flatpak-builder ──
|
||||
- name: Prepare system tray libraries
|
||||
run: bash prepare-libs.sh
|
||||
|
||||
- name: Prepare .deb for Flatpak build
|
||||
run: bash prepare-deb.sh
|
||||
|
||||
- name: Build Flatpak
|
||||
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
|
||||
with:
|
||||
bundle: org.droposs.client.flatpak
|
||||
manifest-path: packages/drop-app/org.droposs.client.ci.yml
|
||||
cache-key: flatpak-drop-app-${{ github.event.release.tag_name || github.sha }}
|
||||
branch: master
|
||||
|
||||
- name: Upload Flatpak to release
|
||||
if: steps.build_mode.outputs.source == 'release'
|
||||
working-directory: .
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
TAG="${{ steps.build_mode.outputs.tag }}"
|
||||
gh release upload "$TAG" packages/drop-app/org.droposs.client.flatpak \
|
||||
--repo Drop-OSS/drop-app
|
||||
|
||||
- name: Upload Flatpak as workflow artifact
|
||||
if: steps.build_mode.outputs.source == 'source'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: org.droposs.client-flatpak
|
||||
path: packages/drop-app/org.droposs.client.flatpak
|
||||
@@ -0,0 +1,89 @@
|
||||
id: org.droposs.client
|
||||
runtime: org.gnome.Platform
|
||||
runtime-version: '48'
|
||||
sdk: org.gnome.Sdk
|
||||
command: drop-app
|
||||
|
||||
finish-args:
|
||||
- --socket=wayland
|
||||
- --socket=fallback-x11
|
||||
- --device=dri
|
||||
- --share=ipc
|
||||
- --share=network
|
||||
- --filesystem=host
|
||||
- --talk-name=org.kde.StatusNotifierWatcher
|
||||
- --filesystem=xdg-run/tray-icon:create
|
||||
- --env=WEBKIT_DISABLE_COMPOSITING_MODE=1
|
||||
- --env=WEBKIT_DISABLE_DMABUF_RENDERER=1
|
||||
|
||||
modules:
|
||||
- name: drop-app
|
||||
buildsystem: simple
|
||||
sources:
|
||||
- type: file
|
||||
path: drop-app.deb
|
||||
- type: file
|
||||
path: org.droposs.client.metainfo.xml
|
||||
- type: file
|
||||
path: org.droposs.client.desktop
|
||||
- type: file
|
||||
path: org.droposs.client.svg
|
||||
- type: file
|
||||
path: libs/libayatana-appindicator3.so.1
|
||||
- type: file
|
||||
path: libs/libayatana-appindicator3.so.1.0.0
|
||||
- type: file
|
||||
path: libs/libayatana-ido3-0.4.so.0
|
||||
- type: file
|
||||
path: libs/libayatana-ido3-0.4.so.0.0.0
|
||||
- type: file
|
||||
path: libs/libayatana-indicator3.so.7
|
||||
- type: file
|
||||
path: libs/libayatana-indicator3.so.7.0.0
|
||||
- type: file
|
||||
path: libs/libdbusmenu-glib.so.4
|
||||
- type: file
|
||||
path: libs/libdbusmenu-glib.so.4.0.12
|
||||
- type: file
|
||||
path: libs/libdbusmenu-gtk3.so.4
|
||||
- type: file
|
||||
path: libs/libdbusmenu-gtk3.so.4.0.12
|
||||
build-commands:
|
||||
- |
|
||||
set -euo pipefail
|
||||
|
||||
# Extract the .deb
|
||||
mkdir -p deb-extract
|
||||
cd deb-extract
|
||||
ar x "../drop-app.deb"
|
||||
tar xzf data.tar.gz
|
||||
cd ..
|
||||
|
||||
# Binary
|
||||
install -Dm755 deb-extract/usr/bin/drop-app /app/bin/drop-app
|
||||
|
||||
# Desktop entry (use our Flatpak-specific version)
|
||||
install -Dm644 org.droposs.client.desktop /app/share/applications/org.droposs.client.desktop
|
||||
|
||||
# AppStream metainfo
|
||||
install -Dm644 org.droposs.client.metainfo.xml /app/share/metainfo/org.droposs.client.metainfo.xml
|
||||
|
||||
# System tray indicator libraries
|
||||
install -Dm755 libs/libayatana-appindicator3.so.1.0.0 /app/lib/libayatana-appindicator3.so.1.0.0
|
||||
ln -sf libayatana-appindicator3.so.1.0.0 /app/lib/libayatana-appindicator3.so.1
|
||||
install -Dm755 libs/libayatana-ido3-0.4.so.0.0.0 /app/lib/libayatana-ido3-0.4.so.0.0.0
|
||||
ln -sf libayatana-ido3-0.4.so.0.0.0 /app/lib/libayatana-ido3-0.4.so.0
|
||||
install -Dm755 libs/libayatana-indicator3.so.7.0.0 /app/lib/libayatana-indicator3.so.7.0.0
|
||||
ln -sf libayatana-indicator3.so.7.0.0 /app/lib/libayatana-indicator3.so.7
|
||||
install -Dm755 libs/libdbusmenu-glib.so.4.0.12 /app/lib/libdbusmenu-glib.so.4.0.12
|
||||
ln -sf libdbusmenu-glib.so.4.0.12 /app/lib/libdbusmenu-glib.so.4
|
||||
install -Dm755 libs/libdbusmenu-gtk3.so.4.0.12 /app/lib/libdbusmenu-gtk3.so.4.0.12
|
||||
ln -sf libdbusmenu-gtk3.so.4.0.12 /app/lib/libdbusmenu-gtk3.so.4
|
||||
|
||||
# SVG icon (scalable — not in the .deb)
|
||||
install -Dm644 org.droposs.client.svg /app/share/icons/hicolor/scalable/apps/org.droposs.client.svg
|
||||
|
||||
# PNG icons from the .deb (already at standard hicolor paths)
|
||||
if [ -d "deb-extract/usr/share/icons/hicolor" ]; then
|
||||
cp -r deb-extract/usr/share/icons/hicolor/* /app/share/icons/hicolor/
|
||||
fi
|
||||
Executable
+46
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
# prepare-deb.sh — Bridge between versioned Tauri .deb output and the
|
||||
# predictable drop-app.deb path expected by the Flatpak CI manifest.
|
||||
#
|
||||
# Usage:
|
||||
# ./packages/drop-app/prepare-deb.sh
|
||||
#
|
||||
# Run this after `pnpm tauri build --bundles deb` to create a symlink
|
||||
# at packages/drop-app/drop-app.deb pointing to the actual versioned .deb.
|
||||
#
|
||||
# In CI, the Tauri build produces the .deb into the app source's
|
||||
# src-tauri/target/release/bundle/deb/ directory.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# The Tauri build output directory — relative to the app source root
|
||||
DEB_DIR="${SCRIPT_DIR}/app-src/src-tauri/target/release/bundle/deb"
|
||||
|
||||
if [ ! -d "$DEB_DIR" ]; then
|
||||
echo "Error: Tauri build output directory not found: $DEB_DIR" >&2
|
||||
echo "Make sure to run 'pnpm tauri build --bundles deb' in the app source first." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shopt -s nullglob
|
||||
debs=("$DEB_DIR"/*_amd64.deb)
|
||||
shopt -u nullglob
|
||||
|
||||
if [ ${#debs[@]} -eq 0 ]; then
|
||||
echo "Error: No .deb file found in $DEB_DIR" >&2
|
||||
echo "Expected a file matching *_amd64.deb" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
actual_deb="${debs[0]}"
|
||||
link_target="$SCRIPT_DIR/drop-app.deb"
|
||||
|
||||
# Remove old symlink if it exists
|
||||
if [ -L "$link_target" ] || [ -e "$link_target" ]; then
|
||||
rm -f "$link_target"
|
||||
fi
|
||||
|
||||
ln -sf "$(realpath "$actual_deb")" "$link_target"
|
||||
echo "Created symlink: $link_target -> $(realpath "$actual_deb")"
|
||||
Executable
+60
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env bash
|
||||
# prepare-libs.sh — Copy host system tray libraries into packages/drop-app/libs/
|
||||
# for bundling in the Flatpak build.
|
||||
#
|
||||
# These libraries (libayatana-appindicator3, libdbusmenu) are not available
|
||||
# in the GNOME Platform runtime, so we bundle them from the host.
|
||||
#
|
||||
# Usage:
|
||||
# ./packages/drop-app/prepare-libs.sh
|
||||
#
|
||||
# In CI (Ubuntu), run this after:
|
||||
# sudo apt-get install -y libayatana-appindicator3-dev libdbusmenu-gtk3-dev
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
LIBS_DIR="${SCRIPT_DIR}/libs"
|
||||
mkdir -p "$LIBS_DIR"
|
||||
|
||||
# Library files needed at runtime — copied from host system
|
||||
declare -A REQUIRED_LIBS=(
|
||||
["libayatana-appindicator3.so.1"]="libayatana-appindicator3.so.1"
|
||||
["libayatana-appindicator3.so.1.0.0"]="libayatana-appindicator3.so.1.0.0"
|
||||
["libayatana-ido3-0.4.so.0"]="libayatana-ido3-0.4.so.0"
|
||||
["libayatana-ido3-0.4.so.0.0.0"]="libayatana-ido3-0.4.so.0.0.0"
|
||||
["libayatana-indicator3.so.7"]="libayatana-indicator3.so.7"
|
||||
["libayatana-indicator3.so.7.0.0"]="libayatana-indicator3.so.7.0.0"
|
||||
["libdbusmenu-glib.so.4"]="libdbusmenu-glib.so.4"
|
||||
["libdbusmenu-glib.so.4.0.12"]="libdbusmenu-glib.so.4.0.12"
|
||||
["libdbusmenu-gtk3.so.4"]="libdbusmenu-gtk3.so.4"
|
||||
["libdbusmenu-gtk3.so.4.0.12"]="libdbusmenu-gtk3.so.4.0.12"
|
||||
)
|
||||
|
||||
all_found=true
|
||||
for soname in "${!REQUIRED_LIBS[@]}"; do
|
||||
libfile="${REQUIRED_LIBS[$soname]}"
|
||||
found=$(find /usr/lib64 /usr/lib /lib64 /lib -name "$libfile" -type f 2>/dev/null | head -1)
|
||||
if [ -n "$found" ]; then
|
||||
cp -f "$found" "$LIBS_DIR/$soname"
|
||||
echo " ✓ $soname ($(du -h "$found" | cut -f1))"
|
||||
else
|
||||
found_ld=$(ldconfig -p 2>/dev/null | grep "$libfile" | awk '{print $NF}' | head -1)
|
||||
if [ -n "$found_ld" ] && [ -f "$found_ld" ]; then
|
||||
cp -f "$found_ld" "$LIBS_DIR/$soname"
|
||||
echo " ✓ $soname via ldconfig ($(du -h "$found_ld" | cut -f1))"
|
||||
else
|
||||
echo " ✗ $soname NOT FOUND — install libayatana-appindicator3-dev and libdbusmenu-gtk3-dev" >&2
|
||||
all_found=false
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$all_found" = false ]; then
|
||||
echo "Error: Some required libraries were not found." >&2
|
||||
echo "Install them and re-run:" >&2
|
||||
echo " # Ubuntu: sudo apt-get install libayatana-appindicator3-dev libdbusmenu-gtk3-dev" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "All system tray libraries prepared in $LIBS_DIR"
|
||||
Reference in New Issue
Block a user