name: Build on: push: branches: [ "main" ] pull_request: branches: [ "main" ] permissions: write-all concurrency: group: ${{ github.ref }}-${{ github.workflow }} cancel-in-progress: true jobs: build: strategy: fail-fast: false matrix: include: # - platform: android # os: ubuntu-latest # targets: aab,apk # target: android # - platform: windows # os: windows-latest # aarch: amd64 # targets: exe # Flutter does not support x86 # - platform: windows # os: windows-latest # aarch: 386 # targets: exe # target: windows-x86 # Flutter does not support x86 # - platform: linux # os: ubuntu-latest # aarch: 386 # targets: AppImage - platform: macos os: macos-11 aarch: universal targets: dmg # - platform: linux # os: ubuntu-latest # aarch: amd64 # targets: AppImage runs-on: ${{ matrix.os }} steps: - name: checkout uses: actions/checkout@v3 - name: Cache Flutter dependencies uses: actions/cache@v2 with: path: | ~/.pub-cache key: ${{ runner.os }}-pub-cache-${{ hashFiles('**/pubspec.lock') }} restore-keys: | ${{ runner.os }}-pub-cache- - name: Setup Flutter uses: subosito/flutter-action@v2 with: flutter-version: '3.10.6' channel: 'stable' cache: true - name: Build macos dmg if: matrix.platform == 'macos' run: | brew install create-dmg tree - name: Setup Java if: matrix.platform == 'android' uses: actions/setup-java@v3 with: distribution: "zulu" java-version: 11 - name: Setup Linux dependencies if: matrix.platform == 'linux' run: | sudo apt install -y locate ninja-build pkg-config libgtk-3-dev libglib2.0-dev libgio2.0-cil-dev libayatana-appindicator3-dev fuse sudo modprobe fuse wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" chmod +x appimagetool mv appimagetool /usr/local/bin/ - name: Setup Flutter Distributor if: matrix.platform != 'android' # shell: powershell run: | dart pub global activate flutter_distributor - name: Get Geo Assets run: | make get-geo-assets - name: Get Dependencies run: | make get - name: Generate run: | make gen make translate - name: Get Libs ${{ matrix.platform }} run: | make ${{ matrix.platform }}-libs - name: Release ${{ matrix.platform }} run: | make ${{ matrix.platform }}-release - name: Copy to out WINDOWS if: matrix.platform == 'windows' run: | New-Item -ItemType Directory -Force -Name "out" $EXT_ARRAY = "${{ matrix.targets }}" -split "," foreach ($EXT in $EXT_ARRAY) { # Find all files with this extension in the current directory, and copy them to "out" directory Get-ChildItem -Recurse -File -Filter "*setup.$EXT" | Copy-Item -Destination "out" -ErrorAction SilentlyContinue move out\*setup.$EXT out\hiddify-${{ matrix.platform }}-x64-setup.$EXT Get-ChildItem -Recurse -File -Filter "*.$EXT" } mkdir ${{ matrix.platform }}-portable xcopy /s /v D:\a\hiddify-next\hiddify-next\build\windows\runner\Release\ .\${{ matrix.platform }}-portable\ Compress-Archive ${{ matrix.platform }}-portable out\hiddify-${{ matrix.platform }}-x64-portable.zip - name: Copy to out unix if: matrix.platform != 'windows' run: | ls -R mkdir out IFS=',' read -r -a EXT_ARRAY <<< "${{ matrix.targets }}" # Loop over extensions for EXT in "${EXT_ARRAY[@]}"; do # Find all files with this extension in SRC_DIR, and copy them to DST_DIR find "." -type f -name "*.$EXT" -exec cp {} "out" \; done mv out/*arm64-v8a*.apk out/hiddify-android-arm64.apk || echo "no arm64 apk" mv out/*armeabi-v7a*.apk out/hiddify-android-arm7.apk || echo "no arm7 apk" mv out/*x86_64*.apk out/hiddify-android-x86_64.apk || echo "no x64 apk" mv out/*.AppImage out/hiddify-linux-x64.AppImage || echo "no app image" - uses: actions/upload-artifact@v3 with: name: ${{ matrix.platform }} path: ./out retention-days: 2 - name: Create or Update Draft Release uses: softprops/action-gh-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: files: ./out/* name: "draft" tag_name: "draft" prerelease: true overwrite: true