Skip to content

An open-source cross-platform alternative to AirDrop

feat: add x86_64 rpm package to release workflow (#3038)

Basil Crow39f215e4f6f1
diff --git a/.github/workflows/build_linux_rpm.yml b/.github/workflows/build_linux_rpm.yml
deleted file mode 100644
index d4966252..00000000
--- a/.github/workflows/build_linux_rpm.yml
+++ /dev/null
@@ -1,81 +0,0 @@
-name: Build linux rpm
-
-on:
- workflow_dispatch:
-
-env:
- FLUTTER_VERSION: "3.41.9"
-
-jobs:
- build:
- runs-on: ubuntu-latest
- outputs:
- version: ${{ steps.get_version.outputs.version }}
-
- steps:
- - uses: actions/checkout@v6
-
- - name: Get version from pubspec.yaml
- id: get_version
- run: |
- VERSION=$(sed -n 's/^version: \([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' app/pubspec.yaml)
- echo "version=$VERSION" >> $GITHUB_OUTPUT
-
- build_rpm:
- runs-on: ubuntu-latest
- container: fedora:38
- steps:
- - uses: actions/checkout@v6
-
- - name: Install dependencies
- run: sudo dnf install -y clang cmake gtk3-devel ninja-build libappindicator-gtk3-devel jq findutils which git patchelf rpm-build
-
- - uses: subosito/flutter-action@v2
- with:
- flutter-version: ${{ env.FLUTTER_VERSION }}
- channel: "stable"
-
- - name: Configure safe directory for Git
- run: git config --global --add safe.directory "/opt/hostedtoolcache/flutter/stable-${{ env.FLUTTER_VERSION }}-x64"
-
-# - name: Configure safe directory for Git (pub-cache)
-# run: git config --global --add safe.directory "/opt/hostedtoolcache/flutter/stable-${{ env.FLUTTER_VERSION }}-x64/.pub-cache"
-
- - name: Get flutter path
- run: which flutter
-
- - name: Get dart path
- run: which dart
-
- - name: Enable dart_distributor
- run: PUB_CACHE=/opt/hostedtoolcache/flutter/stable-${{ env.FLUTTER_VERSION }}-x64/.pub-cache dart pub global activate flutter_distributor
-
- - name: Debugging PATH and flutter_distributor
- run: |
- echo "PATH: $PATH"
- command -v flutter_distributor || echo "flutter_distributor not found"
-
- - name: Build rpm package
- working-directory: app
- run: FLUTTER_ROOT=/opt/hostedtoolcache/flutter/stable-${{ env.FLUTTER_VERSION }}-x64 flutter_distributor package --platform linux --targets rpm
-
- - name: Find rpm file
- id: find_rpm
- run: |
- VERSION=${{ needs.build.outputs.version }}
- RPM_PATH=$(find app/dist -name "localsend_app-$VERSION*-linux.rpm")
- echo "rpm_path=$RPM_PATH" >> $GITHUB_OUTPUT
-
- - name: Check if rpm file exists
- id: check_file
- run: |
- if [[ ! -f "${{ steps.find_rpm.outputs.rpm_path }}" ]]; then
- echo "File not found: ${{ steps.find_rpm.outputs.rpm_path }}"
- exit 1
- fi
-
- - name: Upload rpm file
- uses: actions/upload-artifact@v6
- with:
- name: rpm-result
- path: ${{ steps.find_rpm.outputs.rpm_path }}
diff --git a/.github/workflows/build_linux_rpm_x64.yml b/.github/workflows/build_linux_rpm_x64.yml
new file mode 100644
index 00000000..f5bd416f
--- /dev/null
+++ b/.github/workflows/build_linux_rpm_x64.yml
@@ -0,0 +1,90 @@
+name: Build linux x64 rpm
+
+on:
+ workflow_dispatch:
+ workflow_call:
+
+env:
+ FLUTTER_VERSION: "3.41.9"
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ outputs:
+ version: ${{ steps.get_version.outputs.version }}
+
+ steps:
+ - uses: actions/checkout@v6
+
+ - name: Get version from pubspec.yaml
+ id: get_version
+ run: |
+ VERSION=$(sed -n 's/^version: \([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' app/pubspec.yaml)
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
+
+ build_rpm_x86_64:
+ needs: build
+ runs-on: ubuntu-latest
+ container: fedora:45
+ steps:
+ - uses: actions/checkout@v6
+
+ - name: Install dependencies
+ run: dnf install -y clang cmake gtk3-devel ninja-build libappindicator-gtk3-devel jq findutils which git patchelf rpm-build
+
+ - uses: subosito/flutter-action@v2
+ with:
+ flutter-version: ${{ env.FLUTTER_VERSION }}
+ channel: "stable"
+
+ - name: Configure safe directory for Git
+ run: git config --global --add safe.directory "$FLUTTER_ROOT"
+
+ - name: Install Rust
+ uses: actions-rs/toolchain@v1
+ with:
+ toolchain: stable
+
+ - name: Check rust-toolchain.toml
+ working-directory: packages/localsend_isolates
+ run: rustup show
+
+ - name: Enable dart_distributor
+ run: dart pub global activate flutter_distributor
+
+ # rpm 4.20+ runs %install in a per-package build subdirectory, while
+ # flutter_app_packager stages the bundle and desktop assets in its parent.
+ # Patch the Dart template variables and verify all four copy commands.
+ - name: Patch flutter_app_packager for rpm 4.20
+ run: |
+ F=$(find "$HOME/.pub-cache/hosted/pub.dev" -path '*/flutter_app_packager-*/lib/src/makers/rpm/make_rpm_config.dart' | head -1)
+ test -n "$F"
+ sed -i 's|cp -r \$appName/|cp -r ../$appName/|; s|cp -r \$appBinaryName|cp -r ../$appBinaryName|g' "$F"
+ test "$(grep -cF 'cp -r ../' "$F")" -eq 4
+ dart pub global deactivate flutter_distributor
+ dart pub global activate flutter_distributor
+
+ - name: Build rpm package
+ working-directory: app
+ run: flutter_distributor package --platform linux --targets rpm
+
+ - name: Find rpm file
+ id: find_rpm
+ run: |
+ VERSION=${{ needs.build.outputs.version }}
+ RPM_PATH=$(find app/dist -name "localsend_app-$VERSION*-linux.rpm")
+ echo "rpm_path=$RPM_PATH" >> $GITHUB_OUTPUT
+
+ - name: Check if rpm file exists
+ id: check_file
+ run: |
+ if [ ! -f "${{ steps.find_rpm.outputs.rpm_path }}" ]; then
+ echo "File not found: ${{ steps.find_rpm.outputs.rpm_path }}"
+ exit 1
+ fi
+
+ - name: Upload rpm file
+ uses: actions/upload-artifact@v6
+ with:
+ name: rpm-x86-64-result
+ path: ${{ steps.find_rpm.outputs.rpm_path }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index f332f446..577f585e 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -23,6 +23,9 @@ jobs:
build_deb_arm_64:
uses: ./.github/workflows/build_linux_deb_arm64.yml
+ build_rpm_x86_64:
+ uses: ./.github/workflows/build_linux_rpm_x64.yml
+
build_appimage_x86_64:
uses: ./.github/workflows/build_linux_appimage_x64.yml
@@ -64,6 +67,7 @@ jobs:
- build_tar_arm_64
- build_deb_x86_64
- build_deb_arm_64
+ - build_rpm_x86_64
- build_appimage_x86_64
- build_windows_zip_x86_64
- build_windows_zip_arm_64
@@ -216,6 +220,26 @@ jobs:
asset_name: LocalSend-${{ steps.get_version.outputs.version }}-linux-arm-64.deb
asset_content_type: application/vnd.debian.binary-package
+ # RPM (x86_64)
+ - name: Download rpm file
+ uses: actions/download-artifact@v7
+ with:
+ name: rpm-x86-64-result
+ path: rpm-x86-64-result
+
+ - name: Copy rpm file to root
+ run: cp rpm-x86-64-result/*.rpm result.rpm
+
+ - name: Upload Release Asset
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ steps.draft_release.outputs.upload_url }}
+ asset_path: result.rpm
+ asset_name: LocalSend-${{ steps.get_version.outputs.version }}-linux-x86-64.rpm
+ asset_content_type: application/x-rpm
+
# APPIMAGE (x86_64)
- name: Download AppImage file
uses: actions/download-artifact@v7