feat: Add Linux desktop build support to CI/CD workflow

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 <noreply@anthropic.com>
This commit is contained in:
Janez T
2025-10-22 20:44:36 +02:00
parent 963bd8a8aa
commit 39c95ced95

View File

@@ -448,12 +448,67 @@ jobs:
path: MeshCore-SAR-Windows.zip path: MeshCore-SAR-Windows.zip
retention-days: 30 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 Cloudflare R2 (Unstable Bucket)
upload-to-r2: upload-to-r2:
name: Upload to Cloudflare 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 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: steps:
- name: Checkout code for git log - name: Checkout code for git log
@@ -493,6 +548,14 @@ jobs:
name: windows-executable name: windows-executable
path: artifacts/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 - name: Verify downloaded artifacts
run: | run: |
echo "=== Downloaded build artifacts for R2 upload ===" echo "=== Downloaded build artifacts for R2 upload ==="
@@ -630,6 +693,17 @@ jobs:
echo "⚠️ Skipping Windows ZIP: Directory artifacts/windows-executable not found" echo "⚠️ Skipping Windows ZIP: Directory artifacts/windows-executable not found"
fi 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 # Copy commits data
if [ -f commits.json ]; then if [ -f commits.json ]; then
echo "✅ Copying commits.json" echo "✅ Copying commits.json"
@@ -1024,6 +1098,26 @@ jobs:
HTMLEOF HTMLEOF
fi 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" <<HTMLEOF
<div class="download-card">
<div class="download-info">
<div class="download-platform">
<span class="platform-icon">🐧</span>
<span class="platform-name">Linux (x64)</span>
</div>
<div class="file-name">$LINUX_FILE</div>
<div class="file-size">Size: $LINUX_SIZE</div>
</div>
<a href="$BASE_URL/$LINUX_FILE" class="download-btn" download>Download</a>
</div>
HTMLEOF
fi
# Add commit history section # Add commit history section
if [ -f "$BUILD_DIR/commits.json" ]; then if [ -f "$BUILD_DIR/commits.json" ]; then
# Read commits JSON and embed it directly in the HTML # 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 echo "- 🪟 **Windows ZIP**: [$WIN_FILE]($BASE_URL/$WIN_FILE)" >> $GITHUB_STEP_SUMMARY
fi 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 "" >> $GITHUB_STEP_SUMMARY
echo "- 📋 **Manifest**: [manifest.json]($BASE_URL/manifest.json)" >> $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 echo "- 📝 **Commits**: [commits.json]($BASE_URL/commits.json)" >> $GITHUB_STEP_SUMMARY
@@ -1245,7 +1344,7 @@ jobs:
# Create Release on Tag # Create Release on Tag
create-release: create-release:
name: 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 runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/v')
@@ -1263,6 +1362,7 @@ jobs:
artifacts/android-appbundle/*.aab artifacts/android-appbundle/*.aab
artifacts/macos-dmg/*.dmg artifacts/macos-dmg/*.dmg
artifacts/windows-executable/*.zip artifacts/windows-executable/*.zip
artifacts/linux-executable/*.tar.gz
draft: true draft: true
generate_release_notes: true generate_release_notes: true
env: env: