diff --git a/.github/workflows/distribute_internal.yml b/.github/workflows/distribute_internal.yml index e8ee4f0fe1..bffa747a35 100644 --- a/.github/workflows/distribute_internal.yml +++ b/.github/workflows/distribute_internal.yml @@ -149,3 +149,52 @@ jobs: MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} APPSTORE_API_KEY: ${{ secrets.APPSTORE_API_KEY }} run: bundle exec fastlane distribute_to_firebase + + ios_testflight: + needs: determine_platforms + if: ${{ needs.determine_platforms.outputs.run_ios == 'true' }} + runs-on: macos-15 # Requires xcode 15 or later + timeout-minutes: 30 + steps: + - name: Connect Bot + uses: webfactory/ssh-agent@v0.9.1 + with: + ssh-private-key: ${{ secrets.BOT_SSH_PRIVATE_KEY }} + + - name: "Git Checkout" + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '26.3' + + - name: "Install Flutter" + uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ env.FLUTTER_VERSION }} + channel: stable + cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }} + + - name: "Disable Swift Package Manager" + run: flutter config --no-enable-swift-package-manager + + - name: "Install Tools" + run: flutter pub global activate melos + + - name: "Bootstrap Workspace" + run: melos bootstrap + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + working-directory: sample_app/ios + + - name: Distribute to TestFlight Internal + working-directory: sample_app/ios + env: + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + APPSTORE_API_KEY: ${{ secrets.APPSTORE_API_KEY }} + run: bundle exec fastlane distribute_to_testflight_internal diff --git a/sample_app/ios/fastlane/Fastfile b/sample_app/ios/fastlane/Fastfile index 2f4fcaefc1..88687c7aa8 100644 --- a/sample_app/ios/fastlane/Fastfile +++ b/sample_app/ios/fastlane/Fastfile @@ -120,6 +120,32 @@ platform :ios do ) end + desc "Build and distribute app to TestFlight Internal Testers with auto-incrementing build number" + # Usage: bundle exec fastlane ios distribute_to_testflight_internal + lane :distribute_to_testflight_internal do + match_me + + current_build_number = latest_testflight_build_number( + api_key: appstore_api_key, + app_identifier: app_identifier + ) + + build_number = (current_build_number || 0).to_i + 1 + build_ipa(export_method: "app-store", build_number: build_number) + + upload_dsyms_to_crashlytics + + upload_to_testflight( + api_key: appstore_api_key, + distribute_external: false, + notify_external_testers: false, + ipa: "#{root_path}/build/ios/ipa/ChatSample.ipa", + groups: ['Internal Testers'], + changelog: 'Lots of amazing new features to test out!', + skip_waiting_for_build_processing: true, + ) + end + desc "Upload iOS dSYMs from the most recent `flutter build ipa` to Firebase Crashlytics" private_lane :upload_dsyms_to_crashlytics do dsym_zip = zip( diff --git a/sample_app/pubspec.yaml b/sample_app/pubspec.yaml index bf15d0110e..48a3d7b105 100644 --- a/sample_app/pubspec.yaml +++ b/sample_app/pubspec.yaml @@ -1,7 +1,7 @@ name: sample_app description: A new Flutter project. publish_to: "none" -version: 2.2.0 +version: 9.24.0 # Note: The environment configuration and dependency versions are managed by Melos. # diff --git a/tools/generate_version.dart b/tools/generate_version.dart index 9d5a33e32f..2427bf385e 100755 --- a/tools/generate_version.dart +++ b/tools/generate_version.dart @@ -40,4 +40,24 @@ Future main() async { await versionFile.writeAsString(updatedContent); print('✓ Successfully updated version to $version in $versionFilePath'); + + var cleanedVersion = version; + if (cleanedVersion.contains('-')) { + cleanedVersion = cleanedVersion.split('-').first; + + print('Cleaned version for app: $cleanedVersion'); + } + + // Update the version in the sample_app pubspec.yaml + final sampleAppPubspecPath = p.join(rootDir, 'sample_app', 'pubspec.yaml'); + final sampleAppPubspec = File(sampleAppPubspecPath).readAsStringSync(); + final updatedSampleAppPubspec = sampleAppPubspec.replaceFirst( + RegExp('version: .+'), + 'version: $cleanedVersion', + ); + + await File(sampleAppPubspecPath).writeAsString(updatedSampleAppPubspec); + + print( + '✓ Successfully updated version to $cleanedVersion in $sampleAppPubspecPath'); }