Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fastlane build_app does not apply Flutter Flavor / Xcode Scheme #21924

Closed
4 tasks done
terdar-attempto opened this issue Mar 14, 2024 · 3 comments
Closed
4 tasks done

Comments

@terdar-attempto
Copy link

New Issue Checklist

Issue Description

We are currently using Fastlane with GitHub Actions as CI/CD pipeline for our Flutter Project. We have the issue that we want to build the app with different flavours/schemes depending on the target environment (TestFlight/Android Internal Test Track for Testing, App Store, Play Store Prod for Production) but the specified flavor/scheme seems to get lost during the build_app command. This results in performing a "fallback" to the default "Release" scheme, resulting in the app having no flavor (Calling appFlavor in the Flutter App returns null). But when running/building the app locally without fastlane, everything works fine and the flavor/scheme is applied correctly. Please don't mind the appStore_prod lane, it is only preserved for the future. For now, only the appStore_test lane is important. I hope you are able to help me.

Command executed
build_app(
     scheme: "staging",
     configuration: "Release-staging",
     xcargs: "-allowProvisioningUpdates",
     export_options: {
        signingStyle: "manual",
        provisioningProfiles: {
          "<BUNDLE_IDENTIFIER>" => "<PROVISIONING_PROFILE_NAME>"
        }
       }
     )
Complete output when running fastlane, including the stack trace and command used
INFO [2024-03-13 14:04:37.70]: -----------------------
INFO [2024-03-13 14:04:37.70]: --- Step: build_app ---
INFO [2024-03-13 14:04:37.70]: -----------------------
WARN [2024-03-13 14:04:37.75]: Resolving Swift Package Manager dependencies...
INFO [2024-03-13 14:04:37.75]: $ xcodebuild -resolvePackageDependencies -workspace ./Runner.xcworkspace -scheme staging -configuration Release-staging
INFO [2024-03-13 14:04:38.85]: ▸ Command line invocation:
INFO [2024-03-13 14:04:38.85]: ▸     /Applications/Xcode_15.0.1.app/Contents/Developer/usr/bin/xcodebuild -resolvePackageDependencies -workspace ./Runner.xcworkspace -scheme staging -configuration Release-staging
INFO [2024-03-13 14:04:38.85]: ▸ User defaults from command line:
INFO [2024-03-13 14:04:38.85]: ▸     IDEPackageSupportUseBuiltinSCM = YES
INFO [2024-03-13 14:04:43.85]: ▸ resolved source packages: 
INFO [2024-03-13 14:04:43.86]: $ xcodebuild -showBuildSettings -workspace ./Runner.xcworkspace -scheme staging -configuration Release-staging 2>&1
WARN [2024-03-13 14:04:46.87]: Command timed out after 3 seconds on try 1 of 4, trying again with a 6 second timeout...
DEBUG [2024-03-13 14:04:49.40]: Parsing project file '/Users/runner/work/<OUR_APP_NAME>-flutter/<OUR_APP_NAME>-flutter/ios/Runner.xcodeproj' to find selected provisioning profiles
DEBUG [2024-03-13 14:04:49.40]: Finding provision profiles for 'Release-staging'
DEBUG [2024-03-13 14:04:49.48]: Merging provisioning profile mappings
DEBUG [2024-03-13 14:04:49.48]: -------------------------------------
DEBUG [2024-03-13 14:04:49.48]: Primary provisioning profile mapping:
DEBUG [2024-03-13 14:04:49.48]: {"eu.<OUR_COMPANY_NAME>.<OUR_APP_NAME>flutter.<OUR_APP_NAME>Flutter"=>"<OUR_APP_NAME> Flutter Neu"}
DEBUG [2024-03-13 14:04:49.48]: Secondary provisioning profile mapping:
DEBUG [2024-03-13 14:04:49.48]: {}
DEBUG [2024-03-13 14:04:49.48]: Resulting in the following mapping:
DEBUG [2024-03-13 14:04:49.48]: {:"eu.<OUR_COMPANY_NAME>.<OUR_APP_NAME>flutter.<OUR_APP_NAME>Flutter"=>"<OUR_APP_NAME> Flutter Neu"}
INFO [2024-03-13 14:04:49.49]: Detected provisioning profile mapping: {:"eu.<OUR_COMPANY_NAME>.<OUR_APP_NAME>flutter.<OUR_APP_NAME>Flutter"=>"<OUR_APP_NAME> Flutter Neu"}

+-----------------------------------------------------------------------------------------------------------------------------------------+
|                                                         Summary for gym 2.219.0                                                         |
+-----------------------------------------------------------------------------+-----------------------------------------------------------+
| scheme                                                                      | staging                                                   |
| configuration                                                               | Release-staging                                           |
| xcargs                                                                      | -allowProvisioningUpdates                                 |
| export_options.signingStyle                                                 | manual                                                    |
| export_options.provisioningProfiles.eu.<OUR_COMPANY_NAME>.<OUR_APP_NAME>flutter.<OUR_APP_NAME>Flutter | <OUR_APP_NAME> Flutter Neu                                        |
| workspace                                                                   | ./Runner.xcworkspace                                      |
| clean                                                                       | false                                                     |
| output_directory                                                            | .                                                         |
| output_name                                                                 | Runner                                                    |
| silent                                                                      | false                                                     |
| skip_package_ipa                                                            | false                                                     |
| skip_package_pkg                                                            | false                                                     |
| build_path                                                                  | /Users/runner/Library/Developer/Xcode/Archives/2024-03-13 |
| result_bundle                                                               | false                                                     |
| buildlog_path                                                               | ~/Library/Logs/gym                                        |
| destination                                                                 | generic/platform=iOS                                      |
| xcodebuild_formatter                                                        | xcbeautify                                                |
| build_timing_summary                                                        | false                                                     |
| skip_profile_detection                                                      | false                                                     |
| xcodebuild_command                                                          | xcodebuild                                                |
| skip_package_dependencies_resolution                                        | false                                                     |
| disable_package_automatic_updates                                           | false                                                     |
| use_system_scm                                                              | false                                                     |
| xcode_path                                                                  | /Applications/Xcode_15.0.1.app                            |
+-----------------------------------------------------------------------------+-----------------------------------------------------------+

+--------------------------------------------------------------------------------------------------------------------------------------+
|                                                       Generated Build Command                                                        |
+---------------------------------------------------------------------------------------------------------------+----------------------+
| Option                                                                                                        | Value                |
+---------------------------------------------------------------------------------------------------------------+----------------------+
| set -o pipefail &&                                                                                            |                      |
| xcodebuild                                                                                                    |                      |
| -workspace ./Runner.xcworkspace                                                                               |                      |
| -scheme staging                                                                                               |                      |
| -configuration Release-staging                                                                                |                      |
| -destination                                                                                                  | generic/platform=iOS |
| -archivePath /Users/runner/Library/Developer/Xcode/Archives/2024-03-13/Runner\ 2024-03-13\ 14.04.49.xcarchive |                      |
| -allowProvisioningUpdates                                                                                     |                      |
| archive                                                                                                       |                      |
| | tee /Users/runner/Library/Logs/gym/Runner-staging.log                                                       |                      |
| | xcbeautify                                                                                                  |                      |
+---------------------------------------------------------------------------------------------------------------+----------------------+
INFO [2024-03-13 14:04:49.53]: $ set -o pipefail && xcodebuild -workspace ./Runner.xcworkspace -scheme staging -configuration Release-staging -destination 'generic/platform=iOS' -archivePath /Users/runner/Library/Developer/Xcode/Archives/2024-03-13/Runner\ 2024-03-13\ 14.04.49.xcarchive -allowProvisioningUpdates archive | tee /Users/runner/Library/Logs/gym/Runner-staging.log | xcbeautify
INFO [2024-03-13 14:04:52.48]: ▸ 2024-03-13 14:04:52.479 xcodebuild[5512:23338] [MT] DVTAssertions: Warning in /System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot11/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-22269/IDEFoundation/Provisioning/Capabilities Infrastructure/IDECapabilityQuerySelection.swift:103
INFO [2024-03-13 14:04:52.48]: ▸ Details:  createItemModels creation requirements should not create capability item model for a capability item model that already exists.
INFO [2024-03-13 14:04:52.48]: ▸ Function: createItemModels(for:itemModelSource:)
INFO [2024-03-13 14:04:52.48]: ▸ Thread:   <_NSMainThread: 0x600002c6c3c0>{number = 1, name = main}
INFO [2024-03-13 14:04:52.48]: ▸ Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
...

(Hundreds of these Xcode capability statements but these don't affect the build essentially I think...)

...

INFO [2024-03-13 14:05:08.82]: ▸ [webview_flutter_wkwebview] Compiling FWFDataConverters.m
INFO [2024-03-13 14:05:08.84]: ▸ [webview_flutter_wkwebview] Compiling FLTWebViewFlutterPlugin.m
INFO [2024-03-13 14:05:08.84]: ▸ [Pods-Runner] Compiling Pods_Runner_vers.c
INFO [2024-03-13 14:05:08.84]: ▸ [Pods-Runner] Compiling Pods-Runner-dummy.m
INFO [2024-03-13 14:05:09.14]: ▸ [webview_flutter_wkwebview] Generating webview_flutter_wkwebview.framework.dSYM
INFO [2024-03-13 14:05:09.57]: ▸ [webview_flutter_wkwebview] Touching webview_flutter_wkwebview.framework
INFO [2024-03-13 14:05:09.58]: ▸ [Pods-Runner] Processing Pods-Runner-Info.plist
INFO [2024-03-13 14:05:09.65]: ▸ [Pods-Runner] Touching Pods_Runner.framework
INFO [2024-03-13 14:05:09.66]: ▸ [Runner] Running script [CP] Check Pods Manifest.lock
INFO [2024-03-13 14:05:09.70]: ▸ [Runner] Running script Run Script
INFO [2024-03-13 14:06:02.53]: ▸ [Runner] Copying AppFrameworkInfo.plist
INFO [2024-03-13 14:06:02.53]: ▸ [Runner] Compiling Main.storyboard
INFO [2024-03-13 14:06:15.01]: ▸ [Runner] Compiling LaunchScreen.storyboard
INFO [2024-03-13 14:06:17.24]: ▸ [Runner] Processing Info.plist
INFO [2024-03-13 14:06:17.27]: ▸ [Runner] Compiling Runner_vers.c
INFO [2024-03-13 14:06:17.35]: ▸ [Runner] Compiling GeneratedPluginRegistrant.m
INFO [2024-03-13 14:06:21.99]: ▸ [Runner] Generating Runner.app.dSYM
INFO [2024-03-13 14:06:22.20]: ▸ [Runner] Running script Thin Binary
INFO [2024-03-13 14:06:24.13]: ▸ [Runner] Running script [CP] Embed Pods Frameworks
INFO [2024-03-13 14:06:24.98]: ▸ Signing Runner.app (in target 'Runner' from project 'Runner')
INFO [2024-03-13 14:06:25.81]: ▸ [Runner] Touching Runner.app
INFO [2024-03-13 14:06:26.06]: ▸ Archive Succeeded
DEBUG [2024-03-13 14:06:26.09]: Stored the archive in: /Users/runner/Library/Developer/Xcode/Archives/2024-03-13/Runner 2024-03-13 14.04.49.xcarchive
WARN [2024-03-13 14:06:26.10]: Generated plist file with the following values:
INFO [2024-03-13 14:06:26.10]: ▸ -----------------------------------------
INFO [2024-03-13 14:06:26.10]: ▸ {
INFO [2024-03-13 14:06:26.10]: ▸   "signingStyle": "manual",
INFO [2024-03-13 14:06:26.10]: ▸   "provisioningProfiles": {
INFO [2024-03-13 14:06:26.10]: ▸     "eu.<OUR_COMPANY_NAME>.<OUR_APP_NAME>flutter.<OUR_APP_NAME>Flutter": "<OUR_APP_NAME> Flutter Neu"
INFO [2024-03-13 14:06:26.10]: ▸   },
INFO [2024-03-13 14:06:26.10]: ▸   "method": "app-store"
INFO [2024-03-13 14:06:26.10]: ▸ }
INFO [2024-03-13 14:06:26.10]: ▸ -----------------------------------------
INFO [2024-03-13 14:06:26.10]: This results in the following plist file:
INFO [2024-03-13 14:06:26.10]: ▸ -----------------------------------------
INFO [2024-03-13 14:06:26.10]: ▸ <?xml version="1.0" encoding="UTF-8"?>
INFO [2024-03-13 14:06:26.10]: ▸ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
INFO [2024-03-13 14:06:26.10]: ▸ <plist version="1.0">
INFO [2024-03-13 14:06:26.10]: ▸ <dict>
INFO [2024-03-13 14:06:26.10]: ▸ 	<key>method</key>
INFO [2024-03-13 14:06:26.10]: ▸ 	<string>app-store</string>
INFO [2024-03-13 14:06:26.10]: ▸ 	<key>provisioningProfiles</key>
INFO [2024-03-13 14:06:26.10]: ▸ 	<dict>
INFO [2024-03-13 14:06:26.10]: ▸ 		<key>eu.<OUR_COMPANY_NAME>.<OUR_APP_NAME>flutter.<OUR_APP_NAME>Flutter</key>
INFO [2024-03-13 14:06:26.10]: ▸ 		<string><OUR_APP_NAME> Flutter Neu</string>
INFO [2024-03-13 14:06:26.10]: ▸ 	</dict>
INFO [2024-03-13 14:06:26.10]: ▸ 	<key>signingStyle</key>
INFO [2024-03-13 14:06:26.10]: ▸ 	<string>manual</string>
INFO [2024-03-13 14:06:26.10]: ▸ </dict>
INFO [2024-03-13 14:06:26.10]: ▸ </plist>
INFO [2024-03-13 14:06:26.10]: ▸ -----------------------------------------
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                                                                 Generated Package Command                                                                                                 |
+-----------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------+
| Option                                                                                                                            | Value                                                                                 |
+-----------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------+
| /usr/bin/xcrun /usr/local/lib/ruby/gems/3.0.0/gems/fastlane-2.219.0/gym/lib/assets/wrap_xcodebuild/xcbuild-safe.sh -exportArchive |                                                                                       |
| -exportOptionsPlist                                                                                                               | /var/folders/f8/xn9w26457_v2fc5qzhbrlyj00000gn/T/gym_config20240313-5026-a1gl5o.plist |
| -archivePath /Users/runner/Library/Developer/Xcode/Archives/2024-03-13/Runner\ 2024-03-13\ 14.04.49.xcarchive                     |                                                                                       |
| -exportPath                                                                                                                       | /var/folders/f8/xn9w26457_v2fc5qzhbrlyj00000gn/T/gym_output20240313-5026-dhxczn       |
| -allowProvisioningUpdates                                                                                                         |                                                                                       |
+-----------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------+
INFO [2024-03-13 14:06:26.15]: $ /usr/bin/xcrun /usr/local/lib/ruby/gems/3.0.0/gems/fastlane-2.219.0/gym/lib/assets/wrap_xcodebuild/xcbuild-safe.sh -exportArchive -exportOptionsPlist '/var/folders/f8/xn9w26457_v2fc5qzhbrlyj00000gn/T/gym_config20240313-5026-a1gl5o.plist' -archivePath /Users/runner/Library/Developer/Xcode/Archives/2024-03-13/Runner\ 2024-03-13\ 14.04.49.xcarchive -exportPath '/var/folders/f8/xn9w26457_v2fc5qzhbrlyj00000gn/T/gym_output20240313-5026-dhxczn' -allowProvisioningUpdates 
INFO [2024-03-13 14:06:26.36]: ▸ + xcodebuild -exportArchive -exportOptionsPlist /var/folders/f8/xn9w26457_v2fc5qzhbrlyj00000gn/T/gym_config20240313-5026-a1gl5o.plist -archivePath '/Users/runner/Library/Developer/Xcode/Archives/2024-03-13/Runner 2024-03-13 14.04.49.xcarchive' -exportPath /var/folders/f8/xn9w26457_v2fc5qzhbrlyj00000gn/T/gym_output20240313-5026-dhxczn -allowProvisioningUpdates
INFO [2024-03-13 14:06:30.31]: ▸ 2024-03-13 14:06:30.313 xcodebuild[8332:30400] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path "/var/folders/f8/xn9w26457_v2fc5qzhbrlyj00000gn/T/staging_2024-03-13_14-06-30.311.xcdistributionlogs".
INFO [2024-03-13 14:06:41.60]: ▸ Exported staging to: /var/folders/f8/xn9w26457_v2fc5qzhbrlyj00000gn/T/gym_output20240313-5026-dhxczn
INFO [2024-03-13 14:06:41.60]: ▸ ** EXPORT SUCCEEDED **
INFO [2024-03-13 14:06:41.62]: Compressing 3 dSYM(s)
INFO [2024-03-13 14:06:41.62]: $ cd '/Users/runner/Library/Developer/Xcode/Archives/2024-03-13/Runner 2024-03-13 14.04.49.xcarchive/dSYMs' && zip -r '/Users/runner/work/<OUR_APP_NAME>-flutter/<OUR_APP_NAME>-flutter/ios/Runner.app.dSYM.zip' *.dSYM
INFO [2024-03-13 14:06:41.95]: ▸ updating: App.framework.dSYM/ (stored 0%)
INFO [2024-03-13 14:06:41.95]: ▸ updating: App.framework.dSYM/Contents/ (stored 0%)
INFO [2024-03-13 14:06:41.95]: ▸ updating: App.framework.dSYM/Contents/Resources/ (stored 0%)
INFO [2024-03-13 14:06:41.95]: ▸ updating: App.framework.dSYM/Contents/Resources/DWARF/ (stored 0%)
INFO [2024-03-13 14:06:41.95]: ▸ updating: App.framework.dSYM/Contents/Resources/DWARF/App (deflated 67%)
INFO [2024-03-13 14:06:41.95]: ▸ updating: Runner.app.dSYM/ (stored 0%)
INFO [2024-03-13 14:06:41.95]: ▸ updating: Runner.app.dSYM/Contents/ (stored 0%)
INFO [2024-03-13 14:06:41.95]: ▸ updating: Runner.app.dSYM/Contents/Resources/ (stored 0%)
INFO [2024-03-13 14:06:41.95]: ▸ updating: Runner.app.dSYM/Contents/Resources/Relocations/ (stored 0%)
INFO [2024-03-13 14:06:41.95]: ▸ updating: Runner.app.dSYM/Contents/Resources/Relocations/aarch64/ (stored 0%)
INFO [2024-03-13 14:06:41.95]: ▸ updating: Runner.app.dSYM/Contents/Resources/Relocations/aarch64/Runner.yml (deflated 80%)
INFO [2024-03-13 14:06:41.95]: ▸ updating: Runner.app.dSYM/Contents/Resources/DWARF/ (stored 0%)
INFO [2024-03-13 14:06:41.95]: ▸ updating: Runner.app.dSYM/Contents/Resources/DWARF/Runner (deflated 59%)
INFO [2024-03-13 14:06:41.95]: ▸ updating: Runner.app.dSYM/Contents/Info.plist (deflated 52%)
INFO [2024-03-13 14:06:41.95]: ▸   adding: webview_flutter_wkwebview.framework.dSYM/ (stored 0%)
INFO [2024-03-13 14:06:41.95]: ▸   adding: webview_flutter_wkwebview.framework.dSYM/Contents/ (stored 0%)
INFO [2024-03-13 14:06:41.95]: ▸   adding: webview_flutter_wkwebview.framework.dSYM/Contents/Resources/ (stored 0%)
INFO [2024-03-13 14:06:41.95]: ▸   adding: webview_flutter_wkwebview.framework.dSYM/Contents/Resources/Relocations/ (stored 0%)
INFO [2024-03-13 14:06:41.95]: ▸   adding: webview_flutter_wkwebview.framework.dSYM/Contents/Resources/Relocations/aarch64/ (stored 0%)
INFO [2024-03-13 14:06:41.95]: ▸   adding: webview_flutter_wkwebview.framework.dSYM/Contents/Resources/Relocations/aarch64/webview_flutter_wkwebview.yml (deflated 87%)
INFO [2024-03-13 14:06:41.95]: ▸   adding: webview_flutter_wkwebview.framework.dSYM/Contents/Resources/DWARF/ (stored 0%)
INFO [2024-03-13 14:06:41.95]: ▸   adding: webview_flutter_wkwebview.framework.dSYM/Contents/Resources/DWARF/webview_flutter_wkwebview (deflated 65%)
INFO [2024-03-13 14:06:41.95]: ▸   adding: webview_flutter_wkwebview.framework.dSYM/Contents/Info.plist (deflated 52%)

INFO [2024-03-13 14:06:41.95]: Successfully exported and compressed dSYM file
INFO [2024-03-13 14:06:41.96]: Successfully exported and signed the ipa file:
INFO [2024-03-13 14:06:41.96]: /Users/runner/work/<OUR_APP_NAME>-flutter/<OUR_APP_NAME>-flutter/ios/Runner.ipa
INFO [2024-03-13 14:06:41.98]: ----------------------------------
INFO [2024-03-13 14:06:41.98]: --- Step: upload_to_testflight ---
INFO [2024-03-13 14:06:41.98]: ----------------------------------
...

Environment

 [08:31:07]: fastlane detected a Gemfile in the current directory
[08:31:07]: However, it seems like you didn't use `bundle exec`
[08:31:07]: To launch fastlane faster, please use
[08:31:07]: 
[08:31:07]: $ bundle exec fastlane env
[08:31:07]: 
[08:31:07]: Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile
[08:31:09]: Sending anonymous analytics information
[08:31:09]: Learn more at https://docs.fastlane.tools/#metrics
[08:31:09]: No personal or sensitive data is sent.
[08:31:09]: You can disable this by adding `opt_out_usage` at the top of your Fastfile
[08:31:09]: Generating fastlane environment output, this might take a few seconds...
✅ fastlane environment ✅

Stack

Key Value
OS 13.6.4
Ruby 3.0.6
Bundler? false
Git git version 2.43.0
Installation Source /usr/local/lib/ruby/gems/3.0.0/bin/fastlane
Host macOS 13.6.4 (22G513)
Ruby Lib Dir /usr/local/Cellar/ruby@3.0/3.0.6_1/lib
OpenSSL Version OpenSSL 3.1.1 30 May 2023
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode_15.0.1.app/Contents/Developer/
Xcode Version 15.0.1
Swift Version 5.9

System Locale

Variable Value
LANG en_US.UTF-8
LC_ALL en_US.UTF-8
LANGUAGE

fastlane files:

`./fastlane/Fastfile`
default_platform(:ios)

platform :ios do
  desc "Upload to TestFlight"
  lane :appstore_test do

    api_key = app_store_connect_api_key(
        key_id: ENV["OP_APP_STORE_CONNECT_API_KEY_ID"],
        issuer_id: ENV["OP_APP_STORE_CONNECT_ISSUER_ID"],
        key_filepath: ENV["APP_STORE_CONNECT_API_KEY_PATH"]
    )

    increment_build_number(
        build_number: latest_testflight_build_number(api_key: api_key) + 1,
        xcodeproj: "Runner.xcodeproj"
    )

    build_app(
     scheme: "staging",
     configuration: "Release-staging",
     xcargs: "-allowProvisioningUpdates",
     export_options: {
        signingStyle: "manual",
        provisioningProfiles: {
          "eu.<OUR_COMPANY_NAME>.<OUR_APP_NAME>flutter.<OUR_APP_NAME>Flutter" => "<OUR_APP_NAME> Flutter Neu"
        }
       }
     )
    upload_to_testflight(api_key: api_key)
  end

  desc "Upload to App Store"
  lane :appstore_prod do

      api_key = app_store_connect_api_key(
          key_id: ENV["OP_APP_STORE_CONNECT_API_KEY_ID"],
          issuer_id: ENV["OP_APP_STORE_CONNECT_ISSUER_ID"],
          key_filepath: ENV["APP_STORE_CONNECT_API_KEY_PATH"]
      )

      increment_build_number(
          build_number: app_store_build_number(api_key: api_key) + 1,
          xcodeproj: "Runner.xcodeproj" # TODO: create new App Scheme for release and change here
      )

      build_app(
       workspace: "Runner.xcworkspace", # TODO: create new App Scheme for release and change here
       scheme: "Runner", # TODO: create new App Scheme for release and change here
       xcargs: "-allowProvisioningUpdates",
       export_options: {
          signingStyle: "manual",
          provisioningProfiles: {
            "eu.<OUR_COMPANY_NAME>.<OUR_APP_NAME>flutter.<OUR_APP_NAME>Flutter" => "<OUR_APP_NAME> Flutter Neu" # TODO: change provisioning profile here!
          }
         }
       )
      upload_to_app_store(api_key: api_key)
    end
end
`./fastlane/Appfile`
app_identifier("eu.<OUR_COMPANY_NAME>.<OUR_APP_NAME>flutter.<OUR_APP_NAME>Flutter") # The bundle identifier of your app
apple_id("<MY_NAME>@<OUR_APP_NAME>.de") # Your Apple Developer Portal username

  itc_team_id("<APP_STORE_CONNECT_TEAM_ID>") # App Store Connect Team ID
team_id("<DEVELOPER_PORTAL_TEAM_ID>") # Developer Portal Team ID

# For more information about the Appfile, see:
#     https://docs.fastlane.tools/advanced/#appfile

fastlane gems

Gem Version Update-Status
fastlane 2.219.0 ✅ Up-To-Date

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
did_you_mean 1.5.0
public_suffix 4.0.7
addressable 2.8.6
artifactory 3.0.15
jmespath 1.6.2
aws-partitions 1.887.0
aws-eventstream 1.3.0
aws-sigv4 1.8.0
aws-sdk-core 3.191.0
aws-sdk-kms 1.77.0
aws-sdk-s3 1.143.0
babosa 1.0.4
bundler 2.5.5
rexml 3.2.5
CFPropertyList 3.0.6
colored 1.2
highline 2.0.3
commander 4.6.0
dotenv 2.8.1
emoji_regex 3.2.3
excon 0.109.0
faraday-em_http 1.0.0
faraday-em_synchrony 1.0.0
faraday-excon 1.1.0
faraday-httpclient 1.0.1
multipart-post 2.3.0
faraday-multipart 1.0.4
faraday-net_http 1.0.1
faraday-net_http_persistent 1.2.0
faraday-patron 1.0.0
faraday-rack 1.0.0
faraday-retry 1.0.3
ruby2_keywords 0.0.5
faraday 1.10.3
faraday_middleware 1.2.0
domain_name 0.6.20240107
http-cookie 1.0.5
faraday-cookie_jar 0.0.7
fastimage 2.3.0
gh_inspector 1.1.3
uber 0.1.0
declarative 0.0.20
trailblazer-option 0.1.2
representable 3.2.0
retriable 3.1.2
mini_mime 1.1.5
jwt 2.7.1
multi_json 1.15.0
os 1.1.4
signet 0.18.0
googleauth 1.8.1
httpclient 2.8.3
google-apis-core 0.11.3
google-apis-androidpublisher_v3 0.54.0
google-apis-playcustomapp_v1 0.13.0
google-cloud-env 1.6.0
google-cloud-errors 1.3.1
google-cloud-core 1.6.1
google-apis-iamcredentials_v1 0.17.0
google-apis-storage_v1 0.31.0
rake 13.0.3
digest-crc 0.6.5
google-cloud-storage 1.47.0
json 2.5.1
mini_magick 4.12.0
naturally 2.2.1
optparse 0.1.1
plist 3.7.1
rubyzip 2.3.2
security 0.1.3
simctl 1.6.10
terminal-notifier 2.0.0
unicode-display_width 2.5.0
terminal-table 3.0.2
tty-screen 0.8.2
tty-cursor 0.7.1
tty-spinner 0.9.3
word_wrap 1.0.0
atomos 0.1.3
claide 1.1.0
colored2 3.1.2
nanaimo 0.3.0
xcodeproj 1.24.0
rouge 2.0.7
xcpretty 0.3.0
xcpretty-travis-formatter 1.0.1
set 1.0.1
forwardable 1.3.2
logger 1.4.3
pathname 0.1.0
shellwords 0.1.0
cgi 0.2.2
date 3.1.3
timeout 0.1.1
stringio 3.0.1
securerandom 0.1.0
uri 0.10.2
openssl 3.1.0
digest 3.0.0
io-nonblock 0.1.0
ipaddr 1.2.2
io-wait 0.2.0
zlib 2.0.0
resolv 0.2.1
time 0.1.1
open-uri 0.1.0
mutex_m 0.1.1
net-protocol 0.1.1
ostruct 0.3.1
english 0.7.1
erb 2.2.0
strscan 3.0.1
abbrev 0.1.0
io-console 0.5.7
tempfile 0.1.1
delegate 0.2.0
fileutils 1.5.0
tmpdir 0.1.2
base64 0.1.0
singleton 0.1.1
net-http 0.1.1
open3 0.1.1
nkf 0.1.0
prettyprint 0.1.1
pp 0.2.1
find 0.1.0
yaml 0.1.1
psych 3.3.2

generated on: 2024-03-14

[08:31:14]: Take notice that this output may contain sensitive information, or simply information that you don't want to make public. [08:31:14]: Open https://github.com/fastlane/fastlane/issues/new to submit a new issue ✅

Verification that the desired scheme exists in the GitHub runner(Output of xcodebuild -list):

Command line invocation:
    /Applications/Xcode_15.0.1.app/Contents/Developer/usr/bin/xcodebuild -list

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

Information about project "Runner":
    Targets:
        Runner
        RunnerTests

    Build Configurations:
        Debug
        Debug-production
        Debug-staging
        Debug-development
        Release
        Release-production
        Release-staging
        Release-development
        Profile
        Profile-production
        Profile-staging
        Profile-development

    If no build configuration is specified and -scheme is not passed then "Release" is used.

    Schemes:
        development
        production
        Runner
        staging
@terdar-attempto
Copy link
Author

terdar-attempto commented Mar 15, 2024

Update:

Now I have learned that the app flavor is not necessarily equivalent to the Xcode app scheme. When I set the configuration and scheme in the build_app action, the scheme gets applied correctly but the app will have no app flavor. The reason might be that the flavor can only be set via flutter build. My question now is, if there is any way to set the app flavor via build_app?

@Turiginy1941
Copy link

Turiginy1941 commented Apr 25, 2024

It seems like your Fastlane configuration is not recognizing the specified scheme ("staging") during the build process, resulting in a fallback to the default "Release" scheme. This can be frustrating, especially when everything works fine locally but fails in the CI/CD pipeline.

Here are a few steps you can take to troubleshoot and potentially resolve this issue:

  1. Ensure Scheme Exists: Double-check that the "staging" scheme exists in your Xcode project. You can verify this by running the following command locally:

    xcodebuild -list
    

    Make sure that "staging" appears in the list of available schemes.

  2. Verify Scheme in Fastfile: Check your Fastfile configuration to ensure that the "staging" scheme is correctly specified in the build_app command. It seems like you're already specifying it, but it's worth double-checking for any typos or inconsistencies. Dgcustomerfirst

  3. Review GitHub Actions Environment: Make sure the GitHub Actions environment has the necessary configurations and permissions to build with the specified scheme. Sometimes, CI/CD environments can have different configurations or restrictions compared to local development environments.

  4. Debug Logs: Analyze the Fastlane output logs carefully, especially any warnings or errors that might indicate why the specified scheme is not being used during the build process. Look for any specific messages related to scheme selection or configuration.

  5. Explicitly Specify Scheme: Instead of relying on the default behavior, explicitly specify the scheme in the Fastfile command:

    build_app(
      scheme: "staging",
      # Other parameters...
    )
  6. Test with Different Configurations: If possible, try building with different configurations or schemes to see if the issue persists across all configurations or is specific to the "staging" scheme.

  7. Fastlane and Xcode Compatibility: Ensure that the versions of Fastlane and Xcode being used are compatible. Sometimes, issues can arise due to compatibility issues between Fastlane and Xcode versions.

  8. Consult Fastlane Documentation: Refer to the Fastlane documentation or community forums for any known issues or best practices related to specifying schemes in CI/CD environments.

By following these steps and carefully analyzing the Fastlane output, you should be able to diagnose and resolve the issue with specifying the scheme during the build process in your CI/CD pipeline. If the problem persists, you might need to provide more detailed logs or seek assistance from the Fastlane community for further troubleshooting.

@terdar-attempto
Copy link
Author

Thank you for your advice, but as I already indicated in my previous comment, I tried to achieve something that is not possible with the build_app function. The iOS scheme is perfectly recognised by fastlane but my issue was something different. build_app only sets the iOS Build Scheme but not the flutter flavor. The flutter flavor is only applicable with the flutter build command, so I need to build the app in the workflow with this command and then I have to process the build with fastlane. But this is kinda tricky and I was not able yet to achieve that correctly.

For now, I built a workaround to determine in which environment the app currently is. The Flutter Plugin package_info_plus has the information about the installer store and whether this is local(Simulator or physical device), TestFlight or AppStore, I can choose the correct API base for the corresponding environment.

Since this is no issue directly associated with fastlane, we can close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants