name: Build the flutter version of the RustDesk on: workflow_call: inputs: upload-artifact: type: boolean default: true upload-tag: type: string default: "nightly" env: CARGO_NDK_VERSION: "3.1.2" LLVM_VERSION: "15.0.6" FLUTTER_VERSION: "3.10.5" FLUTTER_RUST_BRIDGE_VERSION: "1.75.3" # for arm64 linux FLUTTER_ELINUX_VERSION: "3.10.5" FLUTTER_ELINUX_COMMIT_ID: "410b3ca42f2cd0c485edf517a1666652bab442d4" TAG_NAME: "${{ inputs.upload-tag }}" # vcpkg version: 2023.04.15 # for multiarch gcc compatibility VCPKG_COMMIT_ID: "501db0f17ef6df184fcdbfbe0f87cde2313b6ab1" VERSION: "1.2.1" NDK_VERSION: "r25c" #signing keys env variable checks ANDROID_SIGNING_KEY: '${{ secrets.ANDROID_SIGNING_KEY }}' MACOS_P12_BASE64: '${{ secrets.MACOS_P12_BASE64 }}' # To make a custom build with your own servers set the below secret values RS_PUB_KEY: '${{ secrets.RS_PUB_KEY }}' RENDEZVOUS_SERVER: '${{ secrets.RENDEZVOUS_SERVER }}' UPLOAD_ARTIFACT: "${{ inputs.upload-artifact }}" jobs: build-for-windows-flutter: name: ${{ matrix.job.target }} (${{ matrix.job.os }}) runs-on: ${{ matrix.job.os }} strategy: fail-fast: false matrix: job: # - { target: i686-pc-windows-msvc , os: windows-2019 } # - { target: x86_64-pc-windows-gnu , os: windows-2019 } - { target: x86_64-pc-windows-msvc, os: windows-2019, arch: x86_64 } # - { target: aarch64-pc-windows-msvc, os: windows-2019, arch: aarch64 } steps: - name: Checkout source code uses: actions/checkout@v3 - name: Install LLVM and Clang uses: KyleMayes/install-llvm-action@v1 with: version: ${{ env.LLVM_VERSION }} - name: Install flutter uses: subosito/flutter-action@v2 with: channel: "stable" flutter-version: ${{ env.FLUTTER_VERSION }} cache: true # - name: Replace engine with rustdesk custom flutter engine # run: | # flutter doctor -v # flutter precache --windows # Invoke-WebRequest -Uri https://github.com/Kingtous/engine/releases/download/v3.7.0-rustdesk/windows-x64-release-flutter.zip -OutFile windows-x64-flutter-release.zip # Expand-Archive windows-x64-flutter-release.zip -DestinationPath engine # mv -Force engine/* C:/hostedtoolcache/windows/flutter/stable-${{ env.FLUTTER_VERSION }}-x64/bin/cache/artifacts/engine/windows-x64-release/ - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: toolchain: stable target: ${{ matrix.job.target }} override: true profile: minimal # minimal component installation (ie, no documentation) - uses: Swatinem/rust-cache@v2 with: prefix-key: ${{ matrix.job.os }} - name: Install flutter rust bridge deps run: | cargo install flutter_rust_bridge_codegen --version ${{ env.FLUTTER_RUST_BRIDGE_VERSION }} --features "uuid" Push-Location flutter ; flutter pub get ; Pop-Location ~/.cargo/bin/flutter_rust_bridge_codegen --rust-input ./src/flutter_ffi.rs --dart-output ./flutter/lib/generated_bridge.dart - name: Install vcpkg dependencies run: | cd C:\ git clone https://github.com/Kingtous/rustdesk_thirdpary_lib --depth=1 - name: Build rustdesk env: VCPKG_ROOT: C:\rustdesk_thirdpary_lib\vcpkg run: python3 .\build.py --portable --hwcodec --flutter --feature IddDriver - name: Sign rustdesk files uses: GermanBluefox/code-sign-action@v7 if: env.UPLOAD_ARTIFACT == 'true' with: certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' password: '${{ secrets.WINDOWS_PFX_PASSWORD }}' certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}' # certificatename: '${{ secrets.CERTNAME }}' folder: './flutter/build/windows/runner/Release/' recursive: true - name: Build self-extracted executable shell: bash if: env.UPLOAD_ARTIFACT == 'true' run: | pushd ./libs/portable python3 ./generate.py -f ../../flutter/build/windows/runner/Release/ -o . -e ../../flutter/build/windows/runner/Release/rustdesk.exe popd mkdir -p ./SignOutput mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.exe - name: Sign rustdesk self-extracted file uses: GermanBluefox/code-sign-action@v7 if: env.UPLOAD_ARTIFACT == 'true' with: certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' password: '${{ secrets.WINDOWS_PFX_PASSWORD }}' certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}' # certificatename: '${{ secrets.WINDOWS_PFX_NAME }}' folder: './SignOutput' recursive: false - name: Publish Release uses: softprops/action-gh-release@v1 if: env.UPLOAD_ARTIFACT == 'true' with: prerelease: true tag_name: ${{ env.TAG_NAME }} files: | ./SignOutput/rustdesk-*.exe # The fallback for the flutter version, we use Sciter for 32bit Windows. build-for-windows-sciter: name: ${{ matrix.job.target }} (${{ matrix.job.os }}) runs-on: ${{ matrix.job.os }} # Temporarily disable this action due to additional test is needed. # if: false strategy: fail-fast: false matrix: job: # - { target: i686-pc-windows-msvc , os: windows-2019 } # - { target: x86_64-pc-windows-gnu , os: windows-2019 } - { target: i686-pc-windows-msvc, os: windows-2019, arch: x86 } # - { target: aarch64-pc-windows-msvc, os: windows-2019 } steps: - name: Checkout source code uses: actions/checkout@v3 - name: Install LLVM and Clang uses: rustdesk-org/install-llvm-action-32bit@master with: version: ${{ env.LLVM_VERSION }} - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: toolchain: nightly-${{ matrix.job.target }} target: ${{ matrix.job.target }} override: true profile: minimal # minimal component installation (ie, no documentation) - uses: Swatinem/rust-cache@v2 with: prefix-key: ${{ matrix.job.os }}-sciter - name: Restore from cache and install vcpkg uses: lukka/run-vcpkg@v7 with: setupOnly: true vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} - name: Install vcpkg dependencies run: | cd C:\ git clone https://github.com/Kingtous/rustdesk_thirdpary_lib --depth=1 - name: Build rustdesk id: build shell: bash env: VCPKG_ROOT: C:\rustdesk_thirdpary_lib\vcpkg run: | python3 res/inline-sciter.py # Patch sciter x86 sed -i 's/branch = "dyn"/branch = "dyn_x86"/g' ./Cargo.toml cargo build --features inline --release --bins mkdir -p ./Release mv ./target/release/rustdesk.exe ./Release/rustdesk.exe curl -LJ -o ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dll echo "output_folder=./Release" >> $GITHUB_OUTPUT - name: Sign rustdesk files uses: GermanBluefox/code-sign-action@v7 if: env.UPLOAD_ARTIFACT == 'true' with: certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' password: '${{ secrets.WINDOWS_PFX_PASSWORD }}' certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}' # certificatename: '${{ secrets.CERTNAME }}' folder: './Release/' recursive: true - name: Build self-extracted executable shell: bash run: | pushd ./libs/portable pip3 install -r requirements.txt python3 ./generate.py -f ../../Release/ -o . -e ../../Release/rustdesk.exe popd mkdir -p ./SignOutput mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}-sciter.exe - name: Sign rustdesk self-extracted file uses: GermanBluefox/code-sign-action@v7 with: certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' password: '${{ secrets.WINDOWS_PFX_PASSWORD }}' certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}' # certificatename: '${{ secrets.WINDOWS_PFX_NAME }}' folder: './SignOutput' recursive: false - name: Publish Release uses: softprops/action-gh-release@v1 if: env.UPLOAD_ARTIFACT == 'true' with: prerelease: true tag_name: ${{ env.TAG_NAME }} files: | ./SignOutput/rustdesk-*.exe