sonodrill

Sonodrill, app iOS/Android d’entraînement musical (repères, boucles, vitesse), Kotlin Multiplatform + Compose
git clone https://git.schurger.org/sonodrill.git
Log | Files | Refs

Fastfile (3277B)


      1 require "tmpdir"
      2 
      3 default_platform(:ios)
      4 
      5 platform :ios do
      6   desc "Build and upload to TestFlight"
      7   lane :release do
      8     sh("cd .. && xcodegen generate")
      9 
     10     api_key = app_store_connect_api_key(
     11       key_id: ENV["PERSO_ASC_KEY_ID"],
     12       issuer_id: ENV["PERSO_ASC_ISSUER_ID"],
     13       key_filepath: ENV["PERSO_ASC_KEY_PATH"],
     14     )
     15 
     16     # Distribution certificate of the team, created and installed in the keychain if missing
     17     # The keychain password lets it allow codesign to use the new key without a dialog
     18     get_certificates(api_key: api_key, output_path: Dir.tmpdir, keychain_password: ENV.fetch("KEYCHAIN_PASSWORD", ""))
     19 
     20     # App Store profile (downloaded or created): the export signs manually with it.
     21     # SIGH_FORCE=1 makes a new one, after a capability changed on the App ID.
     22     sigh(app_identifier: "org.schurger.sonodrill", api_key: api_key, output_path: Dir.tmpdir, force: ENV["SIGH_FORCE"] == "1")
     23     profile_name = lane_context[SharedValues::SIGH_NAME]
     24 
     25     build_number = Time.now.strftime("%Y%m%d%H%M")
     26     increment_build_number(
     27       xcodeproj: "iosApp.xcodeproj",
     28       build_number: build_number,
     29     )
     30 
     31     archive_path = File.expand_path("~/Library/Developer/Xcode/Archives/Sonodrill-#{build_number}.xcarchive")
     32     output_dir = File.expand_path("../build_output")
     33     FileUtils.rm_rf(output_dir)
     34 
     35     export_plist = File.expand_path("../ExportOptions.plist")
     36     File.write(export_plist, <<~PLIST)
     37       <?xml version="1.0" encoding="UTF-8"?>
     38       <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     39       <plist version="1.0">
     40       <dict>
     41         <key>method</key>
     42         <string>app-store-connect</string>
     43         <key>signingStyle</key>
     44         <string>manual</string>
     45         <key>signingCertificate</key>
     46         <string>Apple Distribution</string>
     47         <key>provisioningProfiles</key>
     48         <dict>
     49           <key>org.schurger.sonodrill</key>
     50           <string>#{profile_name}</string>
     51         </dict>
     52         <key>teamID</key>
     53         <string>CM5RQKJH56</string>
     54         <key>uploadSymbols</key>
     55         <true/>
     56       </dict>
     57       </plist>
     58     PLIST
     59 
     60     # Archive + Export + Upload in one pipeline using Xcode's built-in ASC auth
     61     sh(
     62       "xcodebuild",
     63       "-scheme", "iosApp",
     64       "-project", "../iosApp.xcodeproj",
     65       "-destination", "generic/platform=iOS",
     66       "-archivePath", archive_path,
     67       "-allowProvisioningUpdates",
     68       "-authenticationKeyPath", ENV["PERSO_ASC_KEY_PATH"],
     69       "-authenticationKeyID", ENV["PERSO_ASC_KEY_ID"],
     70       "-authenticationKeyIssuerID", ENV["PERSO_ASC_ISSUER_ID"],
     71       "archive",
     72     )
     73 
     74     sh(
     75       "xcodebuild",
     76       "-exportArchive",
     77       "-archivePath", archive_path,
     78       "-exportOptionsPlist", export_plist,
     79       "-exportPath", output_dir,
     80       "-allowProvisioningUpdates",
     81       "-authenticationKeyPath", ENV["PERSO_ASC_KEY_PATH"],
     82       "-authenticationKeyID", ENV["PERSO_ASC_KEY_ID"],
     83       "-authenticationKeyIssuerID", ENV["PERSO_ASC_ISSUER_ID"],
     84     )
     85 
     86     upload_to_testflight(
     87       api_key: api_key,
     88       ipa: File.join(output_dir, "Sonodrill.ipa"),
     89       skip_waiting_for_build_processing: true,
     90     )
     91 
     92     UI.success("Upload complete! Check TestFlight for build #{build_number}")
     93   end
     94 end