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: apk # - platform: android-aab # os: ubuntu-latest # targets: aab - 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: ios # os: macos-11 # aarch: universal # targets: ipa - 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@v3 with: path: | ~/.pub-cache ~/.gradle/caches ~/.gradle/wrapper ~/.npm ~/.cache ~/go/pkg/mod 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.13.0' channel: 'stable' cache: true - name: Build macos dmg if: matrix.platform == 'macos' || matrix.platform == 'ios' run: | brew install create-dmg tree node npm install -g appdmg - name: Setup Java if: startsWith(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: ${{ !startsWith(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: Signing properties env: ANDROID_SIGNING_KEY_ALIAS: ${{ secrets.ANDROID_SIGNING_KEY_ALIAS }} ANDROID_SIGNING_KEY_PASSWORD: ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }} ANDROID_SIGNING_STORE_PASSWORD: ${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }} ANDROID_SIGNING_KEY: ${{ secrets.ANDROID_SIGNING_KEY }} run: | cd android pwd touch signing.properties echo $ANDROID_SIGNING_KEY | base64 -d > release.keystore echo "keystore.path=release.keystore" > release.properties echo keystore.password="$ANDROID_SIGNING_STORE_PASSWORD" >> release.properties echo key.alias="$ANDROID_SIGNING_KEY_ALIAS" >> release.properties echo key.password="$ANDROID_SIGNING_KEY_PASSWORD" >> release.properties cp release.* app/ cat release.properties cd .. - 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/*universal*.apk out/hiddify-android-universal.apk || echo "no universal apk" rm out/app-release.apk ||echo "no app-release.apk" mv out/*.aab out/hiddify-android-playstore.aab || echo "no aab" mv out/*.AppImage out/hiddify-linux-x64.AppImage || echo "no app image" mv out/*.dmg out/hiddify-macos-universal.dmg || echo "no macos dmg" - 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