Compare commits

...

3 Commits

Author SHA1 Message Date
lincube
daf294f21e fix: resolve intermittent build failures in CI workflows
Root causes identified and fixed:

1. AirAppHost recursive build issue:
   - Main project triggers AirAppHost build as post-build step
   - AirAppHost references main project, creating circular dependency
   - Added SkipAirAppHostBuild=true to build.yml to break the cycle
   - Release workflow handles AirAppHost separately in publish step

2. NuGet cache path issues:
   - Changed from relative path (.nuget/packages) to absolute path
   - Added NUGET_PACKAGES environment variable with github.workspace
   - Added actions/cache for NuGet packages across all workflows

3. Missing NuGet package caching:
   - Added actions/cache@v4 with proper cache keys
   - Cache key based on Directory.Packages.props hash
   - Fallback restore keys for partial cache hits

These changes should eliminate the intermittent failures caused by:
- File locking conflicts from recursive builds
- Path resolution inconsistencies
- Network-dependent package downloads on every build
2026-06-25 17:18:08 +08:00
lincube
e8254e5048 fix: rewrite Linglong packaging workflow following official guidelines
Based on linyaps-packager-skill reference:
- Use correct ll-builder workflow: build -> list -> export
- Output .layer files instead of .linglong/.uab
- Use proper PREFIX variable format ( instead of )
- Add proper error handling with GitHub Actions annotations
- Update linglong.yaml to follow official template format

References:
- https://github.com/linglongdev/linyaps-packager-skill
- https://github.com/myml/linglong-builder-action
2026-06-25 16:41:12 +08:00
lincube
f7926a287f feat: add AppImage and Flatpak packaging support
- Add AppImage build using linuxdeploy
- Add Flatpak build using flatpak-builder
- Create AppRun script for .NET runtime sharing
- Create Flatpak manifest and desktop file
- Integrate both formats into release workflow
- Upload .AppImage and .flatpak as release artifacts

This provides comprehensive Linux packaging support:
- DEB: For Debian/Ubuntu systems
- Linglong: For Deepin/UOS systems
- AppImage: Universal Linux format (download and run)
- Flatpak: Universal Linux format (sandboxed)

All formats share the same .NET runtime for efficiency.
2026-06-25 16:18:06 +08:00
6 changed files with 364 additions and 45 deletions

View File

@@ -11,6 +11,8 @@ env:
DOTNET_VERSION: '10.0.x'
Solution_Name: LanMountainDesktop.slnx
DOTNET_gcServer: 1
# Use system default NuGet cache to avoid path issues
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
jobs:
build-windows:
@@ -34,11 +36,22 @@ jobs:
dotnet-version: ${{ env.DOTNET_VERSION }}
dotnet-quality: 'preview'
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore
run: dotnet restore ${{ env.Solution_Name }}
- name: Build
run: dotnet build ${{ env.Solution_Name }} --no-restore -c ${{ matrix.configuration }} -v minimal
env:
# Skip AirAppHost build to avoid recursive build issues
SkipAirAppHostBuild: true
- name: Upload artifacts
uses: actions/upload-artifact@v7
@@ -82,11 +95,22 @@ jobs:
dotnet-version: ${{ env.DOTNET_VERSION }}
dotnet-quality: 'preview'
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore
run: dotnet restore ${{ env.Solution_Name }}
- name: Build
run: dotnet build ${{ env.Solution_Name }} --no-restore -c Release -v minimal
env:
# Skip AirAppHost build to avoid recursive build issues
SkipAirAppHostBuild: true
- name: Upload artifacts
uses: actions/upload-artifact@v7
@@ -116,11 +140,22 @@ jobs:
dotnet-version: ${{ env.DOTNET_VERSION }}
dotnet-quality: 'preview'
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore
run: dotnet restore ${{ env.Solution_Name }}
- name: Build
run: dotnet build ${{ env.Solution_Name }} --no-restore -c Release -v minimal
env:
# Skip AirAppHost build to avoid recursive build issues
SkipAirAppHostBuild: true
- name: Upload artifacts
uses: actions/upload-artifact@v7
@@ -147,6 +182,14 @@ jobs:
dotnet-version: ${{ env.DOTNET_VERSION }}
dotnet-quality: 'preview'
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Pack SDK and template packages
shell: pwsh
run: .\scripts\Pack-PluginPackages.ps1 -Configuration Release -OutputPath .\artifacts\nuget

View File

@@ -20,6 +20,8 @@ env:
DOTNET_VERSION: '10.0.x'
Solution_Name: LanMountainDesktop.slnx
DOTNET_gcServer: 1
# Use absolute path for NuGet cache to avoid path resolution issues
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
jobs:
prepare:
@@ -437,6 +439,14 @@ jobs:
dotnet-version: ${{ env.DOTNET_VERSION }}
dotnet-quality: 'preview'
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Stamp release version metadata
shell: pwsh
run: |
@@ -634,42 +644,218 @@ jobs:
echo "LINGLONG_AVAILABLE=false" >> $GITHUB_ENV
fi
- name: Package as Linglong
- name: Build Linglong package
if: env.LINGLONG_AVAILABLE == 'true'
run: |
version="${{ needs.prepare.outputs.version }}"
publishDir="publish/linux-x64"
linglongDir="build-linglong"
release_dir="$PWD/release-assets"
# Create Linglong build directory
mkdir -p "$linglongDir"
mkdir -p "$linglongDir" "$release_dir"
# Copy linglong.yaml and update version
cp packaging/linglong/linglong.yaml "$linglongDir/"
sed -i "s/version: .*/version: ${version}/" "$linglongDir/linglong.yaml"
# Create project structure for Linglong build
mkdir -p "$linglongDir/project"
cp -r "$publishDir" "$linglongDir/project/"
cp -r LanMountainDesktop/packaging "$linglongDir/project/LanMountainDesktop/"
# ll-builder expects the project files in /project inside the container
mkdir -p "$linglongDir/publish"
cp -r "$publishDir"/* "$linglongDir/publish/"
cp -r LanMountainDesktop "$linglongDir/LanMountainDesktop"
# Build Linglong package
# Copy linglong.yaml to the build directory
cp "$linglongDir/linglong.yaml" "$linglongDir/"
# Build using ll-builder
cd "$linglongDir"
ll-builder build || {
echo "Warning: Linglong build failed"
echo "::warning::Linglong build failed"
exit 0
}
# Find and copy the generated package
LINGLONG_PKG=$(find . -name "*.uab" -o -name "*.linglong" 2>/dev/null | head -1)
if [ -n "$LINGLONG_PKG" ]; then
mkdir -p "$PWD/../release-assets"
cp "$LINGLONG_PKG" "$PWD/../release-assets/LanMountainDesktop-${version}-linux-x64.linglong"
echo "Linglong package created successfully"
# List available refs
ll-builder list
# Export the layer
# Get the first available ref
REF=$(ll-builder list | head -1 | awk '{print $1}')
if [ -n "$REF" ]; then
ll-builder export --ref "$REF" || {
echo "::warning::Linglong export failed"
exit 0
}
# Find and copy the generated layer file
LINGLONG_PKG=$(find . -name "*.layer" 2>/dev/null | head -1)
if [ -n "$LINGLONG_PKG" ]; then
cp "$LINGLONG_PKG" "$release_dir/LanMountainDesktop-${version}-linux-x64.layer"
echo "✓ Linglong package created: LanMountainDesktop-${version}-linux-x64.layer"
else
echo "::warning::Linglong layer file not found after export"
fi
else
echo "Warning: Linglong package not found after build"
echo "::warning::No refs available for export"
fi
- name: Build AppImage
run: |
version="${{ needs.prepare.outputs.version }}"
publishDir="publish/linux-x64"
appimageDir="build-appimage"
release_dir="$PWD/release-assets"
mkdir -p "$appimageDir" "$release_dir"
# Download linuxdeploy
wget -q "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" -O linuxdeploy
chmod +x linuxdeploy
# Prepare AppDir structure
mkdir -p "$appimageDir/AppDir/usr/bin"
mkdir -p "$appimageDir/AppDir/usr/share/applications"
mkdir -p "$appimageDir/AppDir/usr/share/icons/hicolor/256x256/apps"
# Copy application files
cp -r "$publishDir"/* "$appimageDir/AppDir/usr/bin/"
# Create desktop file
cat > "$appimageDir/AppDir/LanMountainDesktop.desktop" << EOF
[Desktop Entry]
Type=Application
Version=1.0
Name=LanMountainDesktop
Comment=LanMountainDesktop desktop shell
Exec=LanMountainDesktop.Launcher %U
Icon=lanmountaindesktop
Terminal=false
Categories=Utility;Education;
StartupWMClass=LanMountainDesktop
EOF
# Copy icon
cp LanMountainDesktop/packaging/linux/lanmountaindesktop.png "$appimageDir/AppDir/"
cp LanMountainDesktop/packaging/linux/lanmountaindesktop.png \
"$appimageDir/AppDir/usr/share/icons/hicolor/256x256/apps/"
# Create AppRun script
cat > "$appimageDir/AppDir/AppRun" << 'APPRUN'
#!/bin/bash
SELF=$(readlink -f "$0")
HERE="${SELF%/*}"
# Find the app directory with .NET runtime
APP_DIR=""
for dir in "$HERE/usr/bin"/app-*; do
if [ -d "$dir" ] && [ -f "$dir/LanMountainDesktop.dll" ]; then
APP_DIR="$dir"
break
fi
done
if [ -n "$APP_DIR" ]; then
export DOTNET_ROOT="$APP_DIR"
export PATH="$DOTNET_ROOT:$PATH"
fi
exec "$HERE/usr/bin/LanMountainDesktop.Launcher" "$@"
APPRUN
chmod +x "$appimageDir/AppDir/AppRun"
# Build AppImage
cd "$appimageDir"
../linuxdeploy --appdir AppDir --output appimage || {
echo "Warning: AppImage build failed"
exit 0
}
# Move to release assets
mv LanMountainDesktop-*.AppImage "$release_dir/" 2>/dev/null || \
echo "Warning: AppImage not found after build"
- name: Build Flatpak
run: |
version="${{ needs.prepare.outputs.version }}"
publishDir="publish/linux-x64"
flatpakDir="build-flatpak"
release_dir="$PWD/release-assets"
mkdir -p "$flatpakDir" "$release_dir"
# Install Flatpak tools
sudo apt-get update
sudo apt-get install -y flatpak flatpak-builder
# Add Flathub repository
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo || true
# Create Flatpak manifest
cat > "$flatpakDir/com.lanmountain.desktop.yml" << EOF
app-id: com.lanmountain.desktop
runtime: org.freedesktop.Platform
runtime-version: '23.08'
sdk: org.freedesktop.Sdk
command: LanMountainDesktop.Launcher
finish-args:
- --share=ipc
- --socket=x11
- --socket=wayland
- --socket=pulseaudio
- --share=network
- --device=dri
- --filesystem=home
modules:
- name: LanMountainDesktop
buildsystem: simple
build-commands:
- mkdir -p /app/bin
- cp -r * /app/bin/
- install -Dm755 LanMountainDesktop.Launcher /app/bin/LanMountainDesktop.Launcher
- install -Dm644 LanMountainDesktop.desktop /app/share/applications/com.lanmountain.desktop.desktop
- install -Dm644 lanmountaindesktop.png /app/share/icons/hicolor/256x256/apps/com.lanmountain.desktop.png
sources:
- type: dir
path: .
EOF
# Prepare source directory
mkdir -p "$flatpakDir/source"
cp -r "$publishDir"/* "$flatpakDir/source/"
# Create desktop file
cat > "$flatpakDir/source/LanMountainDesktop.desktop" << EOF
[Desktop Entry]
Type=Application
Version=1.0
Name=LanMountainDesktop
Comment=LanMountainDesktop desktop shell
Exec=LanMountainDesktop.Launcher %U
Icon=com.lanmountain.desktop
Terminal=false
Categories=Utility;Education;
StartupWMClass=LanMountainDesktop
EOF
# Copy icon
cp LanMountainDesktop/packaging/linux/lanmountaindesktop.png \
"$flatpakDir/source/"
# Build Flatpak
cd "$flatpakDir"
flatpak-builder --force-clean --repo=repo build com.lanmountain.desktop.yml || {
echo "Warning: Flatpak build failed"
exit 0
}
# Create Flatpak bundle
flatpak build-bundle repo "$release_dir/LanMountainDesktop-${version}-linux-x64.flatpak" \
com.lanmountain.desktop || {
echo "Warning: Flatpak bundle creation failed"
exit 0
}
- name: Package Payload Zip
run: |
version="${{ needs.prepare.outputs.version }}"
@@ -701,7 +887,9 @@ jobs:
name: release-linux-x64
path: |
release-assets/files-linux-x64.zip
release-assets/*.linglong
release-assets/*.layer
release-assets/*.AppImage
release-assets/*.flatpak
*.deb
if-no-files-found: error
retention-days: 30

View File

@@ -1,4 +1,4 @@
version: '1'
version: "1"
package:
id: com.lanmountain.desktop
@@ -20,59 +20,61 @@ sources:
build: |
# Create directory structure following Linglong conventions
mkdir -p ${PREFIX}/bin
mkdir -p ${PREFIX}/lib
mkdir -p ${PREFIX}/share/applications
mkdir -p ${PREFIX}/share/icons/hicolor/128x128/apps
mkdir -p ${PREFIX}/share/icons/hicolor/256x256/apps
mkdir -p ${PREFIX}/share/icons/hicolor/scalable/apps
mkdir -p $PREFIX/bin
mkdir -p $PREFIX/lib
mkdir -p $PREFIX/share/applications
mkdir -p $PREFIX/share/icons/hicolor/128x128/apps
mkdir -p $PREFIX/share/icons/hicolor/256x256/apps
mkdir -p $PREFIX/share/icons/hicolor/scalable/apps
# Copy the pre-built application files
# The build artifacts should be in /project/publish/linux-x64
if [ -d "/project/publish/linux-x64" ]; then
# Copy main application (includes .NET runtime)
cp -r /project/publish/linux-x64/app-*/* ${PREFIX}/lib/
cp -r /project/publish/linux-x64/app-*/* $PREFIX/lib/
# Copy Launcher (AOT compiled, independent)
cp /project/publish/linux-x64/LanMountainDesktop.Launcher ${PREFIX}/bin/
chmod +x ${PREFIX}/bin/LanMountainDesktop.Launcher
cp /project/publish/linux-x64/LanMountainDesktop.Launcher $PREFIX/bin/
chmod +x $PREFIX/bin/LanMountainDesktop.Launcher
# Copy AirAppRuntime wrapper and DLL
cp /project/publish/linux-x64/LanMountainDesktop.AirAppRuntime ${PREFIX}/bin/
cp /project/publish/linux-x64/LanMountainDesktop.AirAppRuntime.dll ${PREFIX}/lib/
chmod +x ${PREFIX}/bin/LanMountainDesktop.AirAppRuntime
cp /project/publish/linux-x64/LanMountainDesktop.AirAppRuntime $PREFIX/bin/
cp /project/publish/linux-x64/LanMountainDesktop.AirAppRuntime.dll $PREFIX/lib/
chmod +x $PREFIX/bin/LanMountainDesktop.AirAppRuntime
# Copy AirAppHost
if [ -d "/project/publish/linux-x64/AirAppHost" ]; then
cp -r /project/publish/linux-x64/AirAppHost ${PREFIX}/lib/
cp -r /project/publish/linux-x64/AirAppHost $PREFIX/lib/
fi
else
echo "Error: Build artifacts not found at /project/publish/linux-x64"
exit 1
fi
# Create desktop file using printf to avoid heredoc issues
printf '%s\n' '[Desktop Entry]' > ${PREFIX}/share/applications/com.lanmountain.desktop.desktop
printf '%s\n' 'Type=Application' >> ${PREFIX}/share/applications/com.lanmountain.desktop.desktop
printf '%s\n' 'Version=1.0' >> ${PREFIX}/share/applications/com.lanmountain.desktop.desktop
printf '%s\n' 'Name=LanMountainDesktop' >> ${PREFIX}/share/applications/com.lanmountain.desktop.desktop
printf '%s\n' 'Comment=LanMountainDesktop desktop shell' >> ${PREFIX}/share/applications/com.lanmountain.desktop.desktop
printf '%s\n' 'Exec=/opt/apps/com.lanmountain.desktop/files/bin/LanMountainDesktop.Launcher %U' >> ${PREFIX}/share/applications/com.lanmountain.desktop.desktop
printf '%s\n' 'Icon=lanmountaindesktop' >> ${PREFIX}/share/applications/com.lanmountain.desktop.desktop
printf '%s\n' 'Terminal=false' >> ${PREFIX}/share/applications/com.lanmountain.desktop.desktop
printf '%s\n' 'Categories=Utility;Education;' >> ${PREFIX}/share/applications/com.lanmountain.desktop.desktop
printf '%s\n' 'StartupWMClass=LanMountainDesktop' >> ${PREFIX}/share/applications/com.lanmountain.desktop.desktop
# Create desktop file
cat > $PREFIX/share/applications/com.lanmountain.desktop.desktop << EOF
[Desktop Entry]
Type=Application
Version=1.0
Name=LanMountainDesktop
Comment=LanMountainDesktop desktop shell
Exec=/opt/apps/com.lanmountain.desktop/files/bin/LanMountainDesktop.Launcher %U
Icon=lanmountaindesktop
Terminal=false
Categories=Utility;Education;
StartupWMClass=LanMountainDesktop
EOF
# Copy icon files
if [ -f "/project/LanMountainDesktop/packaging/linux/lanmountaindesktop.png" ]; then
cp /project/LanMountainDesktop/packaging/linux/lanmountaindesktop.png \
${PREFIX}/share/icons/hicolor/256x256/apps/
$PREFIX/share/icons/hicolor/256x256/apps/
cp /project/LanMountainDesktop/packaging/linux/lanmountaindesktop.png \
${PREFIX}/share/icons/hicolor/128x128/apps/
$PREFIX/share/icons/hicolor/128x128/apps/
fi
# Set executable permissions
chmod +x ${PREFIX}/bin/*
chmod +x ${PREFIX}/lib/LanMountainDesktop.AirAppRuntime 2>/dev/null || true
chmod +x $PREFIX/bin/*
chmod +x $PREFIX/lib/LanMountainDesktop.AirAppRuntime 2>/dev/null || true
echo "Linglong build completed successfully"

View File

@@ -0,0 +1,22 @@
#!/bin/bash
# AppImage entry point for LanMountainDesktop
SELF=$(readlink -f "$0")
HERE="${SELF%/*}"
# Find the app directory with .NET runtime
APP_DIR=""
for dir in "$HERE/usr/bin"/app-*; do
if [ -d "$dir" ] && [ -f "$dir/LanMountainDesktop.dll" ]; then
APP_DIR="$dir"
break
fi
done
if [ -n "$APP_DIR" ]; then
export DOTNET_ROOT="$APP_DIR"
export PATH="$DOTNET_ROOT:$PATH"
fi
# Launch the application
exec "$HERE/usr/bin/LanMountainDesktop.Launcher" "$@"

View File

@@ -0,0 +1,10 @@
[Desktop Entry]
Type=Application
Version=1.0
Name=LanMountainDesktop
Comment=LanMountainDesktop desktop shell
Exec=LanMountainDesktop.Launcher %U
Icon=com.lanmountain.desktop
Terminal=false
Categories=Utility;Education;
StartupWMClass=LanMountainDesktop

View File

@@ -0,0 +1,54 @@
app-id: com.lanmountain.desktop
runtime: org.freedesktop.Platform
runtime-version: '23.08'
sdk: org.freedesktop.Sdk
command: LanMountainDesktop.Launcher
finish-args:
# X11 + XShm access
- --share=ipc
- --socket=x11
# Wayland access
- --socket=wayland
# GPU acceleration
- --device=dri
# Audio access
- --socket=pulseaudio
# Network access
- --share=network
# Home directory access
- --filesystem=home
# D-Bus access for desktop integration
- --talk-name=org.freedesktop.Notifications
- --talk-name=org.kde.StatusNotifierWatcher
modules:
- name: LanMountainDesktop
buildsystem: simple
build-commands:
# Create directory structure
- mkdir -p /app/bin
- mkdir -p /app/lib
- mkdir -p /app/share/applications
- mkdir -p /app/share/icons/hicolor/256x256/apps
# Copy application files
- cp -r publish/linux-x64/app-*/* /app/lib/
- cp publish/linux-x64/LanMountainDesktop.Launcher /app/bin/
- cp publish/linux-x64/LanMountainDesktop.AirAppRuntime /app/bin/
- cp publish/linux-x64/LanMountainDesktop.AirAppRuntime.dll /app/lib/
# Copy AirAppHost if exists
- if [ -d "publish/linux-x64/AirAppHost" ]; then cp -r publish/linux-x64/AirAppHost /app/lib/; fi
# Set permissions
- chmod +x /app/bin/*
# Install desktop file
- install -Dm644 packaging/linux/Flatpak/com.lanmountain.desktop.desktop /app/share/applications/com.lanmountain.desktop.desktop
# Install icon
- install -Dm644 packaging/linux/lanmountaindesktop.png /app/share/icons/hicolor/256x256/apps/com.lanmountain.desktop.png
sources:
- type: dir
path: ../../..