diff --git a/.github/workflows/build-mobile.yml b/.github/workflows/build-mobile.yml index e4ae09bfd7..c214ba564e 100644 --- a/.github/workflows/build-mobile.yml +++ b/.github/workflows/build-mobile.yml @@ -188,8 +188,8 @@ jobs: needs: pre-job permissions: contents: read - # Run on main branch or workflow_dispatch - if: ${{ !github.event.pull_request.head.repo.fork && fromJSON(needs.pre-job.outputs.should_run).mobile == true && github.ref == 'refs/heads/main' }} + # Run on main branch or workflow_dispatch, or on PRs/other branches (build only, no upload) + if: ${{ !github.event.pull_request.head.repo.fork && fromJSON(needs.pre-job.outputs.should_run).mobile == true }} runs-on: macos-latest steps: @@ -303,12 +303,20 @@ jobs: APP_STORE_CONNECT_API_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }} APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ISSUER_ID }} ENVIRONMENT: ${{ inputs.environment || 'development' }} + BUNDLE_ID_SUFFIX: ${{ inputs.environment == 'production' && '' || 'development' }} + GITHUB_REF: ${{ github.ref }} working-directory: ./mobile/ios run: | - if [[ "$ENVIRONMENT" == "development" ]]; then - bundle exec fastlane gha_testflight_dev + # Only upload to TestFlight on main branch + if [[ "$GITHUB_REF" == "refs/heads/main" ]]; then + if [[ "$ENVIRONMENT" == "development" ]]; then + bundle exec fastlane gha_testflight_dev + else + bundle exec fastlane gha_release_prod + fi else - bundle exec fastlane gha_release_prod + # Build only, no TestFlight upload for non-main branches + bundle exec fastlane gha_build_only fi - name: Clean up keychain diff --git a/mobile/ios/fastlane/Fastfile b/mobile/ios/fastlane/Fastfile index c3dfea5f66..d167d5fb2d 100644 --- a/mobile/ios/fastlane/Fastfile +++ b/mobile/ios/fastlane/Fastfile @@ -112,7 +112,7 @@ end workspace: "Runner.xcworkspace", configuration: configuration, export_method: "app-store", - xcargs: "CODE_SIGN_IDENTITY='#{CODE_SIGN_IDENTITY}' CODE_SIGN_STYLE=Manual", + xcargs: "-skipMacroValidation CODE_SIGN_IDENTITY='#{CODE_SIGN_IDENTITY}' CODE_SIGN_STYLE=Manual", export_options: { provisioningProfiles: { "#{app_identifier}" => "#{app_identifier} AppStore", @@ -195,7 +195,7 @@ end configuration: "Release", export_method: "app-store", skip_package_ipa: false, - xcargs: "-allowProvisioningUpdates", + xcargs: "-skipMacroValidation -allowProvisioningUpdates", export_options: { method: "app-store", signingStyle: "automatic", @@ -210,4 +210,37 @@ end ) end + desc "iOS Build Only (no TestFlight upload)" + lane :gha_build_only do + # Use the same build process as production, just skip the upload + # This ensures PR builds validate the same way as production builds + + # Install provisioning profiles (use development profiles for PR builds) + install_provisioning_profile(path: "profile_dev.mobileprovision") + install_provisioning_profile(path: "profile_dev_share.mobileprovision") + install_provisioning_profile(path: "profile_dev_widget.mobileprovision") + + # Configure code signing for dev bundle IDs + configure_code_signing(bundle_id_suffix: "development") + + # Build the app (same as gha_testflight_dev but without upload) + build_app( + scheme: "Runner", + workspace: "Runner.xcworkspace", + configuration: "Release", + export_method: "app-store", + skip_package_ipa: true, + xcargs: "-skipMacroValidation CODE_SIGN_IDENTITY='#{CODE_SIGN_IDENTITY}' CODE_SIGN_STYLE=Manual", + export_options: { + provisioningProfiles: { + "#{BASE_BUNDLE_ID}.development" => "#{BASE_BUNDLE_ID}.development AppStore", + "#{BASE_BUNDLE_ID}.development.ShareExtension" => "#{BASE_BUNDLE_ID}.development.ShareExtension AppStore", + "#{BASE_BUNDLE_ID}.development.Widget" => "#{BASE_BUNDLE_ID}.development.Widget AppStore" + }, + signingStyle: "manual", + signingCertificate: CODE_SIGN_IDENTITY + } + ) + end + end