From e8254e504834c9078ca5e43bdda47ce53e0cef38 Mon Sep 17 00:00:00 2001 From: lincube Date: Thu, 25 Jun 2026 16:41:12 +0800 Subject: [PATCH] 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 --- .github/workflows/release.yml | 50 +++++++++++++++++--------- packaging/linglong/linglong.yaml | 60 +++++++++++++++++--------------- 2 files changed, 65 insertions(+), 45 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 16a6fcf..99d9be1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -634,40 +634,58 @@ 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 @@ -859,7 +877,7 @@ 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 diff --git a/packaging/linglong/linglong.yaml b/packaging/linglong/linglong.yaml index e2802ee..3a3abbf 100644 --- a/packaging/linglong/linglong.yaml +++ b/packaging/linglong/linglong.yaml @@ -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"