From 39c95ced95b2a4cfee058b2957d59c0536f3aab6 Mon Sep 17 00:00:00 2001 From: Janez T Date: Wed, 22 Oct 2025 20:44:36 +0200 Subject: [PATCH] feat: Add Linux desktop build support to CI/CD workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add build-linux job to compile Linux x64 desktop application and integrate it into the R2 upload and release workflows. Changes: - New build-linux job: Builds Flutter Linux desktop app with GTK-3 - Archives Linux build as tar.gz for distribution - Added Linux artifact download in upload-to-r2 job - Updated artifact preparation to copy Linux archives - Added Linux download card (🐧) to generated index.html - Included Linux artifacts in GitHub releases - Added Linux to download summary in workflow output The Linux build produces MeshCore-SAR-Linux.tar.gz containing the compiled application bundle ready for x64 Linux systems. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/build-multiplatform.yml | 106 +++++++++++++++++++++- 1 file changed, 103 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-multiplatform.yml b/.github/workflows/build-multiplatform.yml index 93514e0..4695d44 100644 --- a/.github/workflows/build-multiplatform.yml +++ b/.github/workflows/build-multiplatform.yml @@ -448,12 +448,67 @@ jobs: path: MeshCore-SAR-Windows.zip retention-days: 30 + # Linux Build + build-linux: + name: Build Linux AppImage + runs-on: ubuntu-latest + needs: [update-version] + if: always() && (needs.update-version.result == 'success' || needs.update-version.result == 'skipped') + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download versioned pubspec + if: startsWith(github.ref, 'refs/tags/v') + uses: actions/download-artifact@v4 + with: + name: versioned-pubspec + path: . + + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ env.FLUTTER_VERSION }} + channel: 'stable' + cache: true + + - name: Install Linux dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev + + - name: Enable Linux desktop + run: flutter config --enable-linux-desktop + + - name: Install dependencies + run: flutter pub get + + - name: Generate localizations + run: flutter gen-l10n + + - name: Build Linux app + run: flutter build linux --release + + - name: Archive Linux Build + run: | + cd build/linux/x64/release/bundle + tar -czf ../../../../../MeshCore-SAR-Linux.tar.gz * + cd ../../../../../ + + - name: Upload Linux Build + uses: actions/upload-artifact@v4 + with: + name: linux-executable + path: MeshCore-SAR-Linux.tar.gz + retention-days: 30 + # Upload to Cloudflare R2 (Unstable Bucket) upload-to-r2: name: Upload to Cloudflare R2 - needs: [build-android, build-ios, build-macos, build-windows] + needs: [build-android, build-ios, build-macos, build-windows, build-linux] runs-on: ubuntu-latest - if: always() && (needs.build-android.result == 'success' || needs.build-ios.result == 'success' || needs.build-macos.result == 'success' || needs.build-windows.result == 'success') + if: always() && (needs.build-android.result == 'success' || needs.build-ios.result == 'success' || needs.build-macos.result == 'success' || needs.build-windows.result == 'success' || needs.build-linux.result == 'success') steps: - name: Checkout code for git log @@ -493,6 +548,14 @@ jobs: name: windows-executable path: artifacts/windows-executable + - name: Download Linux Executable + if: needs.build-linux.result == 'success' + uses: actions/download-artifact@v4 + continue-on-error: true + with: + name: linux-executable + path: artifacts/linux-executable + - name: Verify downloaded artifacts run: | echo "=== Downloaded build artifacts for R2 upload ===" @@ -630,6 +693,17 @@ jobs: echo "⚠️ Skipping Windows ZIP: Directory artifacts/windows-executable not found" fi + # Copy Linux TAR.GZ (search for any .tar.gz file) + if [ -d "artifacts/linux-executable" ]; then + copy_artifact \ + "artifacts/linux-executable" \ + "*.tar.gz" \ + "meshcore-sar-${{ steps.metadata.outputs.build_prefix }}-${{ steps.metadata.outputs.timestamp }}-linux.tar.gz" \ + "Linux TAR.GZ" + else + echo "⚠️ Skipping Linux TAR.GZ: Directory artifacts/linux-executable not found" + fi + # Copy commits data if [ -f commits.json ]; then echo "✅ Copying commits.json" @@ -1024,6 +1098,26 @@ jobs: HTMLEOF fi + # Add Linux TAR.GZ if exists + LINUX_PATH=$(get_latest_file "*-linux.tar.gz") + if [ -n "$LINUX_PATH" ]; then + LINUX_FILE=$(basename "$LINUX_PATH") + LINUX_SIZE=$(get_size "$LINUX_PATH") + cat >> "$BUILD_DIR/index.html" < +
+
+ 🐧 + Linux (x64) +
+
$LINUX_FILE
+
Size: $LINUX_SIZE
+
+ Download + + HTMLEOF + fi + # Add commit history section if [ -f "$BUILD_DIR/commits.json" ]; then # Read commits JSON and embed it directly in the HTML @@ -1235,6 +1329,11 @@ jobs: echo "- 🪟 **Windows ZIP**: [$WIN_FILE]($BASE_URL/$WIN_FILE)" >> $GITHUB_STEP_SUMMARY fi + if [ -f "r2-upload/unstable/${{ steps.metadata.outputs.build_prefix }}"/*-linux.tar.gz ]; then + LINUX_FILE=$(basename r2-upload/unstable/${{ steps.metadata.outputs.build_prefix }}/*-linux.tar.gz) + echo "- 🐧 **Linux TAR.GZ**: [$LINUX_FILE]($BASE_URL/$LINUX_FILE)" >> $GITHUB_STEP_SUMMARY + fi + echo "" >> $GITHUB_STEP_SUMMARY echo "- 📋 **Manifest**: [manifest.json]($BASE_URL/manifest.json)" >> $GITHUB_STEP_SUMMARY echo "- 📝 **Commits**: [commits.json]($BASE_URL/commits.json)" >> $GITHUB_STEP_SUMMARY @@ -1245,7 +1344,7 @@ jobs: # Create Release on Tag create-release: name: Create Release - needs: [build-android, build-ios, build-macos, build-windows] + needs: [build-android, build-ios, build-macos, build-windows, build-linux] runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/v') @@ -1263,6 +1362,7 @@ jobs: artifacts/android-appbundle/*.aab artifacts/macos-dmg/*.dmg artifacts/windows-executable/*.zip + artifacts/linux-executable/*.tar.gz draft: true generate_release_notes: true env: