diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 409cfc90..ad18683c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,15 +36,15 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.12.0 #issue with 2.13 - with: - flutter-version: ${{ env.FLUTTER_VERSION }} - channel: 'stable' - cache: true - - name: Prepare - run: make linux-prepare - - name: Test - run: flutter test + # - uses: subosito/flutter-action@v2.12.0 #issue with 2.13 + # with: + # flutter-version: ${{ env.FLUTTER_VERSION }} + # channel: 'stable' + # cache: true + # - name: Prepare + # run: make linux-prepare + # - name: Test + # run: flutter test - name: make draftBuildCode id: draftBuildCode @@ -80,11 +80,50 @@ jobs: os: macos-13 aarch: universal targets: dmg,pkg - + + - platform: ios + os: macos-13 + aarch: universal + filename: hiddify-ios + targets: ipa runs-on: ${{ matrix.os }} steps: - name: checkout uses: actions/checkout@v3 + - name: Import Apple Codesign Certificates + if: ${{ inputs.upload-artifact && startsWith(matrix.os,'macos') }} + uses: apple-actions/import-codesign-certs@v2 + with: + p12-file-base64: "${{ secrets.APPLE_CERTIFICATE_P12 }}" + p12-password: "${{ secrets.APPLE_CERTIFICATE_P12_PASSWORD }}" + + - name: Import Apple Mobile Provisioning Profile + if: ${{ inputs.upload-artifact && startsWith(matrix.os,'macos') }} + run: | + mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles + echo "${{secrets.APPLE_MOBILE_PROVISIONING_PROFILES_TARGZ_BASE64}}"|base64 --decode | tar xz -C ~/Library/MobileDevice/Provisioning\ Profiles + # echo "${{secrets.APPLE_DEVLOP_PROVISIONING_PROFILES_TARGZ_BASE64}}"|base64 --decode | tar xz -C ~/Library/MobileDevice/Provisioning\ Profiles + + + + + - name: Download Provisioning Profile + if: ${{ inputs.upload-artifact && startsWith(matrix.os,'macos') }} + uses: Apple-Actions/download-provisioning-profiles@v1 + with: + bundle-id: app.hiddify.com + issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }} + api-key-id: ${{ secrets.APPSTORE_API_KEY_ID }} + api-private-key: ${{ secrets.APPSTORE_API_PRIVATE_KEY }} + - name: Download Provisioning Profile SingBoxPacketTunnel + if: ${{ inputs.upload-artifact && startsWith(matrix.os,'macos') }} + uses: Apple-Actions/download-provisioning-profiles@v1 + with: + bundle-id: app.hiddify.com.SingBoxPacketTunnel + issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }} + api-key-id: ${{ secrets.APPSTORE_API_KEY_ID }} + api-private-key: ${{ secrets.APPSTORE_API_PRIVATE_KEY }} + - name: Setup Flutter uses: subosito/flutter-action@v2.12.0 #issue with 2.13 @@ -112,10 +151,6 @@ jobs: run: | make ${{ matrix.platform }}-install-dependencies - - name: Prepare for ${{ matrix.platform }} - run: | - make ${{ matrix.platform }}-prepare - tree - name: Setup Android Signing Properties if: ${{ inputs.upload-artifact && startsWith(matrix.platform,'android') }} @@ -131,42 +166,16 @@ jobs: run: | [IO.File]::WriteAllBytes("windows\sign.pfx", [Convert]::FromBase64String("${{ secrets.WINDOWS_SIGNING_KEY }}")) (Get-Content "windows\packaging\msix\make_config.yaml") -replace '^certificate_password:.*$', 'certificate_password: ${{ secrets.WINDOWS_SIGNING_PASSWORD }}' | Set-Content "windows\packaging\msix\make_config.yaml" - - - - name: Setup Apple certificate and provisioning profile - if: ${{ inputs.upload-artifact && startsWith(matrix.os,'macos') }} - env: - BUILD_CERTIFICATE_BASE64: ${{ secrets.APPLE_BUILD_CERTIFICATE_BASE64 }} - P12_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_P12_PASSWORD }} - BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.APPLE_BUILD_PROVISION_PROFILE_BASE64 }} - BUILD_PACKET_TUNNEL_PROVISION_PROFILE_BASE64: ${{ secrets.APPLE_BUILD_PACKET_TUNNEL_PROVISION_PROFILE_BASE64 }} - KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }} + + - name: Temporary disable Permission Handler for windows due to its issue in permission + if: ${{ startsWith(matrix.platform,'windows') }} run: | - # create variables - CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 - PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision - PP_PACKET_TUNNEL_PATH=$RUNNER_TEMP/build_pppt.mobileprovision - KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db - - # import certificate and provisioning profile from secrets - echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH - echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH - echo -n "$BUILD_PACKET_TUNNEL_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PACKET_TUNNEL_PATH - - # create temporary keychain - security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH - security set-keychain-settings -lut 21600 $KEYCHAIN_PATH - security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH - - # import certificate to keychain - security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH - security list-keychain -d user -s $KEYCHAIN_PATH - - # apply provisioning profile - mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles - cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles - cp $PP_PACKET_TUNNEL_PATH ~/Library/MobileDevice/Provisioning\ Profiles + (Get-Content -Path "pubspec.yaml") -notmatch "permission_handler" | Set-Content -Path "pubspec.yaml" + - name: Prepare for ${{ matrix.platform }} + run: | + make ${{ matrix.platform }}-prepare + tree - name: Build ${{ matrix.platform }} env: SENTRY_DSN: ${{ secrets.SENTRY_DSN }} @@ -235,6 +244,7 @@ jobs: FILENAME=${!KEY} echo "For $EXT ($KEY) filename is ${FILENAME}" mv dist/*/*.$EXT tmp_out/${FILENAME}.$EXT + ls tmp_out chmod +x tmp_out/${FILENAME}.$EXT if [ "${{matrix.platform}}" == "linux" ];then cp ./.github/help/linux/* tmp_out/ @@ -242,7 +252,8 @@ jobs: cp ./.github/help/mac-windows/* tmp_out/ fi if [[ "${{matrix.platform}}" == 'ios' ]];then - mv tmp_out/${FILENAME}.$EXT bin/${FILENAME}.$EXT + echo mv tmp_out/${FILENAME}.$EXT out/ + mv tmp_out/${FILENAME}.$EXT out/ else cd tmp_out # 7z a ${FILENAME}.zip ./ @@ -266,7 +277,14 @@ jobs: name: artifact path: ./out retention-days: 2 - + - name: 'Upload app to TestFlight' + if: ${{ inputs.upload-artifact && startsWith(matrix.os,'macos') && inputs.tag-name != 'draft' }} + uses: apple-actions/upload-testflight-build@v1 + with: + app-path: 'out/Hiddify-iOS.ipa' + issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }} + api-key-id: ${{ secrets.APPSTORE_API_KEY_ID }} + api-private-key: ${{ secrets.APPSTORE_API_PRIVATE_KEY }} update-draft: permissions: write-all if: ${{ inputs.upload-artifact }} @@ -315,7 +333,6 @@ jobs: tag_name: 'draft' body_path: './release.md' prerelease: true - upload-release: permissions: write-all if: ${{ inputs.upload-artifact && inputs.tag-name != 'draft' }} @@ -362,4 +379,6 @@ jobs: packageName: app.hiddify.com releaseName: ${{ env.TAG_NAME }} releaseFiles: ./hiddify-android-market.aab - track: 'beta' \ No newline at end of file + track: 'beta' + + diff --git a/.github/workflows/dev-i copy.yml b/.github/workflows/dev-i copy.yml index db8d6551..80d55f02 100644 --- a/.github/workflows/dev-i copy.yml +++ b/.github/workflows/dev-i copy.yml @@ -2,7 +2,7 @@ name: dev i new on: push: branches: - - ios + - ios2 paths-ignore: - '**.md' - 'docs/**' diff --git a/.github/workflows/dev-i.yml b/.github/workflows/dev-i.yml index 4643c4ec..0edb69dd 100644 --- a/.github/workflows/dev-i.yml +++ b/.github/workflows/dev-i.yml @@ -2,7 +2,7 @@ name: dev i on: push: branches: - - ios + - ios2 paths-ignore: - '**.md' - 'docs/**' diff --git a/Makefile b/Makefile index 59f17175..81393676 100644 --- a/Makefile +++ b/Makefile @@ -58,6 +58,7 @@ prepare: @echo make ios-prepare windows-prepare: get-geo-assets get gen translate windows-libs + ios-prepare: get-geo-assets get gen translate ios-libs macos-prepare: get-geo-assets get gen translate macos-libs linux-prepare: get-geo-assets get gen translate linux-libs @@ -77,7 +78,29 @@ macos-install-dependencies: dart pub global activate flutter_distributor ios-install-dependencies: - echo "not yet implemented" + if [ "$(flutter)" = "true" ]; then + curl -l -o ~/Downloads/flutter_macos_3.19.3-stable.zip https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_3.19.3-stable.zip; + mkdir -p ~/develop; + cd ~/develop; + unzip ~/Downloads/flutter_macos_3.19.3-stable.zip; + export PATH="$$PATH:$$HOME/develop/flutter/bin"; + echo 'export PATH="$$PATH:$$HOME/develop/flutter/bin"' >> ~/.zshrc; + + export PATH="$PATH:$HOME/develop/flutter/bin"; + echo 'export PATH="$PATH:$HOME/develop/flutter/bin"' >> ~/.zshrc; + + curl -sSL https://rvm.io/mpapis.asc | gpg --import - + curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - + curl -sSL https://get.rvm.io | bash -s stable + brew install openssl@1.1 + PKG_CONFIG_PATH=$(brew --prefix openssl@1.1)/lib/pkgconfig rvm install 2.7.5 + sudo gem install cocoapods -V + fi + brew install create-dmg tree + npm install -g appdmg + + dart pub global activate flutter_distributor + android-install-dependencies: echo "nothing yet" @@ -223,4 +246,5 @@ ios-temp-prepare: flutter build ios-framework cd ios pod install - \ No newline at end of file + + diff --git a/lib/bootstrap.dart b/lib/bootstrap.dart index 23dc04e2..c9abc2fb 100644 --- a/lib/bootstrap.dart +++ b/lib/bootstrap.dart @@ -63,7 +63,7 @@ Future lazyBootstrap( ); final enableAnalytics = - true || await container.read(analyticsControllerProvider.future); + await container.read(analyticsControllerProvider.future); if (enableAnalytics) { await _init( "analytics",