app-id: com.lotus.Grain runtime: org.freedesktop.Platform runtime-version: '24.08' sdk: org.freedesktop.Sdk sdk-extensions: - org.freedesktop.Sdk.Extension.node20 - org.freedesktop.Sdk.Extension.rust-stable command: grain finish-args: # Display and graphics - --share=ipc - --socket=fallback-x11 - --socket=wayland - --device=dri # Network access for updates and extensions - --share=network # File system access - --filesystem=home - --filesystem=xdg-documents - --filesystem=xdg-download # System integration - --talk-name=org.freedesktop.Notifications - --talk-name=org.freedesktop.FileManager1 - --talk-name=org.freedesktop.portal.Desktop - --talk-name=org.freedesktop.portal.Documents # Audio for notifications - --socket=pulseaudio # System tray support - --talk-name=org.kde.StatusNotifierWatcher - --talk-name=org.freedesktop.StatusNotifierWatcher # Theme access - --filesystem=xdg-config/gtk-3.0:ro - --filesystem=xdg-config/gtk-4.0:ro # Prevent idle sleep during long writing sessions - --talk-name=org.freedesktop.ScreenSaver modules: - name: grain buildsystem: simple build-options: append-path: /usr/lib/sdk/node20/bin:/usr/lib/sdk/rust-stable/bin env: CARGO_HOME: /run/build/grain/cargo npm_config_cache: /run/build/grain/npm-cache # Optimize build for release CARGO_PROFILE_RELEASE_LTO: 'true' CARGO_PROFILE_RELEASE_CODEGEN_UNITS: '1' CARGO_PROFILE_RELEASE_PANIC: 'abort' build-commands: # Check node/npm version - | echo "=== Checking Node.js environment ===" node --version npm --version # Dependencies are pre-installed by workflow with Bun # node_modules is included in the source directory - | echo "=== Checking pre-installed dependencies ===" if [ -d "node_modules" ]; then echo "✅ node_modules found (pre-installed by Bun)" echo "Size: $(du -sh node_modules | cut -f1)" else echo "⚠ node_modules not found, installing with npm..." npm install --legacy-peer-deps --force fi # Build frontend - | echo "=== Building frontend ===" cd apps/desktop npm run build # Verify build output if [ ! -d "dist" ]; then echo "ERROR: Frontend build failed - dist directory not found" exit 1 fi echo "Frontend build successful" # Build Tauri application (binary only, no bundling) - | echo "=== Building Tauri application ===" cd apps/desktop/src-tauri # 直接用 cargo 构建,跳过 Tauri 的打包步骤 cargo build --release # Verify binary exists if [ ! -f "target/release/grain" ]; then echo "ERROR: Binary not found" ls -la target/release/ || true exit 1 fi echo "Tauri build successful" ls -la target/release/grain # Install binary - | echo "=== Installing binary ===" install -Dm755 apps/desktop/src-tauri/target/release/grain /app/bin/grain # Verify installation if [ ! -x "/app/bin/grain" ]; then echo "ERROR: Binary installation failed" exit 1 fi echo "Binary installed successfully" # Install desktop file - | echo "=== Installing desktop file ===" install -Dm644 flatpak/com.lotus.Grain.desktop /app/share/applications/com.lotus.Grain.desktop # Validate desktop file desktop-file-validate /app/share/applications/com.lotus.Grain.desktop || echo "Desktop file validation warning (non-fatal)" # Install icons (multiple sizes) - | echo "=== Installing icons ===" # Install available icon sizes for size in 32 128 256; do if [ -f "apps/desktop/src-tauri/icons/${size}x${size}.png" ]; then install -Dm644 "apps/desktop/src-tauri/icons/${size}x${size}.png" \ "/app/share/icons/hicolor/${size}x${size}/apps/com.lotus.Grain.png" echo "Installed ${size}x${size} icon" fi done # Install scalable icon if available if [ -f "apps/desktop/src-tauri/icons/icon.svg" ]; then install -Dm644 "apps/desktop/src-tauri/icons/icon.svg" \ "/app/share/icons/hicolor/scalable/apps/com.lotus.Grain.svg" echo "Installed scalable icon" fi # Install metainfo - | echo "=== Installing metainfo ===" install -Dm644 flatpak/com.lotus.Grain.metainfo.xml /app/share/metainfo/com.lotus.Grain.metainfo.xml # Validate metainfo appstream-util validate-relax /app/share/metainfo/com.lotus.Grain.metainfo.xml || echo "Metainfo validation warning (non-fatal)" # Install license - | echo "=== Installing license ===" if [ -f "LICENSE" ]; then install -Dm644 LICENSE /app/share/licenses/com.lotus.Grain/LICENSE fi # Install documentation - | echo "=== Installing documentation ===" if [ -f "README.md" ]; then install -Dm644 README.md /app/share/doc/com.lotus.Grain/README.md fi echo "=== Installation completed successfully ===" sources: - type: dir path: ..