Unify packager config in Cargo metadata #18
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Release Packages | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| artifact_name: linux-x64 | |
| package_cmd: cargo packager -f deb | |
| - os: ubuntu-24.04-arm | |
| artifact_name: linux-arm64 | |
| package_cmd: cargo packager -f deb | |
| - os: windows-latest | |
| artifact_name: windows-x64 | |
| package_cmd: cargo packager -f nsis | |
| - os: windows-11-arm | |
| artifact_name: windows-arm64 | |
| package_cmd: cargo packager -f nsis | |
| - os: macos-15 | |
| artifact_name: macos-arm64 | |
| package_cmd: cargo packager -f dmg | |
| - os: macos-15-intel | |
| artifact_name: macos-intel | |
| package_cmd: cargo packager -f dmg | |
| runs-on: ${{ matrix.os }} | |
| name: Build ${{ matrix.artifact_name }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Use crates.io in CI | |
| shell: bash | |
| run: | | |
| mkdir -p .cargo | |
| cat > .cargo/config.toml <<'EOF' | |
| [registries.crates-io] | |
| protocol = "sparse" | |
| [net] | |
| git-fetch-with-cli = true | |
| EOF | |
| - name: Install Linux dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libayatana-appindicator3-dev \ | |
| libgtk-3-dev \ | |
| libxdo-dev \ | |
| libxkbcommon-dev \ | |
| libxcb-render0-dev \ | |
| libxcb-shape0-dev \ | |
| libxcb-xfixes0-dev \ | |
| libssl-dev \ | |
| pkg-config | |
| - name: Install cargo-packager | |
| run: cargo install cargo-packager --locked | |
| - name: Build binary | |
| run: cargo build --release --locked --bin linuxdo-accelerator | |
| - name: Package app | |
| run: ${{ matrix.package_cmd }} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linuxdo-accelerator-${{ matrix.artifact_name }} | |
| path: | | |
| dist/** | |
| target/release/linuxdo-accelerator* | |
| build-android: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - abi: arm64-v8a | |
| rust_target: aarch64-linux-android | |
| artifact_name: android-arm64-v8a | |
| apk_name: linuxdo-accelerator-android-arm64-v8a.apk | |
| - abi: x86_64 | |
| rust_target: x86_64-linux-android | |
| artifact_name: android-x86_64 | |
| apk_name: linuxdo-accelerator-android-x86_64.apk | |
| runs-on: ubuntu-latest | |
| name: Build ${{ matrix.artifact_name }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| - uses: android-actions/setup-android@v3 | |
| - uses: gradle/actions/setup-gradle@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.rust_target }} | |
| - name: Use crates.io in CI | |
| shell: bash | |
| run: | | |
| mkdir -p .cargo | |
| cat > .cargo/config.toml <<'EOF' | |
| [registries.crates-io] | |
| protocol = "sparse" | |
| [net] | |
| git-fetch-with-cli = true | |
| EOF | |
| - name: Install Android SDK / NDK | |
| shell: bash | |
| run: | | |
| yes | sdkmanager --licenses > /dev/null || true | |
| sdkmanager --install \ | |
| "platform-tools" \ | |
| "platforms;android-35" \ | |
| "build-tools;35.0.0" \ | |
| "ndk;27.2.12479018" | |
| - name: Install cargo-ndk | |
| run: cargo install cargo-ndk --locked | |
| - name: Build Android APK | |
| shell: bash | |
| env: | |
| ANDROID_ABI: ${{ matrix.abi }} | |
| RUST_TARGET: ${{ matrix.rust_target }} | |
| ANDROID_BUILD_TYPE: release | |
| APK_OUTPUT_NAME: ${{ matrix.apk_name }} | |
| run: | | |
| export ANDROID_NDK_HOME="${ANDROID_SDK_ROOT}/ndk/27.2.12479018" | |
| ./scripts/build-android-apk.sh | |
| - name: Upload Android artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linuxdo-accelerator-${{ matrix.artifact_name }} | |
| path: | | |
| android/dist/*.apk | |
| publish-release: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: | |
| - build | |
| - build-android | |
| runs-on: ubuntu-latest | |
| name: Publish GitHub Release | |
| steps: | |
| - name: Download packaged artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: linuxdo-accelerator-* | |
| path: release-artifacts | |
| merge-multiple: false | |
| - name: List release files | |
| run: find release-artifacts -type f | sort | |
| - name: Upload assets to GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| release-artifacts/**/dist/** | |
| release-artifacts/**/*.apk | |
| generate_release_notes: true |