Fastlane, Continuous Deployment to iOS

Fastlane, Continuous Deployment to iOS

Continuous Deployment to iOS

Acbf3391de0494432a92221ffe89f34e?s=128

yohei sugigami

February 28, 2015
Tweet

Transcript

  1. Continuous Deployment to iOS yohei SUGIGAMI deliver • snapshot •

    frameit • PEM • sigh • produce
  2. None
  3. None
  4. None
  5. None
  6. HOT!! Continuous Deployment to iOS

  7. IUUQLJTIJLBXBLBUTVNJIBUFOBCMPHDPNFOUSZ Travis CIͰiOSΞϓϦͷϦϦʔε࡞ۀΛࣗಈԽ͢Δ

  8. Mattt Thompson

  9. Ship.io

  10. None
  11. Build a workflow by the lane

  12. ˔εΫϦʔϯγϣοτΛ࡞Δ ˔ϕʔλ൛ͷϏϧυͱ഑෍Λߦ͏ ˔Ϗϧυͱ"QQ4UPSF΁ͷఏग़Λߦ͏
 ɹϓϩϏδϣχϯάϓϩϑΝΠϧͷߋ৽ ɹ৽͍͠εΫϦʔϯγϣοτͷ࡞੒ "QQ4UPSF΁ͷΞοϓϩʔυ
 ˔$*ͷதͰ࢖͏
 ɹ+FOLJOTɺ5SBWJT$*ɺ$JSDMF$* Use Case

  13. ˒̍,̑̌̌

  14. Meet the fastlane family

  15. None
  16. None
  17. Lets’s install

  18. Lets’s install Install Command Line Tools

  19. Install $ sudo gem install fastlane
 
 Successfully installed fastlane-0.1.9

    Successfully installed fastlane_core-0.1.1 Successfully installed deliver-0.7.10 Successfully installed snapshot-0.4.9 Successfully installed frameit-0.2.2 Successfully installed pem-0.3.4 Successfully installed sigh-0.3.3 Successfully installed produce-0.1.4 $ brew install xctool (for test)
 $ brew install imagemagick (for frameit)
 Options

  20. $ cd [your_project_folder] $ fastlane init
 
 INFO This setup

    will help you get up and running in no time. INFO First, it will move the config files from `deliver` and `snapshot` INFO into the subfolder `fastlane`. INFO Fastlane will check what tools you're already using and set up INFO the tool automatically for you. Have fun! Do you want to get started? This will move your Deliverfile and Snapfile (if they exist) (y/n) y Do you have everything commited in version control? If not please do so! (y/n) y INFO Created new folder './fastlane'. INFO ------------------------------ INFO To not re-enter your username and app identifier every time you run one of the fastlane tools or fastlane, these will be stored from now on. App Identifier (com.krausefx.app): com.hoge.fuga Your Apple ID: hoge@fuga.com INFO Created new file './fastlane/Appfile'. Edit it to manage your preferred app metadata information. Do you want to setup 'deliver', which is used to upload app screenshots, app metadata and app updates to the App Store or Apple TestFlight? (y/n) y INFO Loading up 'deliver', this might take a few seconds Phantomjs does not appear to be installed in /Users/hoge/.phantomjs/1.9.8/darwin/bin/phantomjs, installing! Init
  21. Successfully installed phantomjs. Yay! Removed temporarily downloaded files. Do you

    want Deliver to automatically create the Deliverfile for you based on your current app? The app has to be in the App Store to use this feature. (y/n) y First, you need to login with your iTunesConnect credentials. This is necessary to fetch the latest metadata from your app and use it to create a Deliverfile for you. If you have previously entered your credentials already, you will not be asked again. No username or password given. You can set environment variables: DELIVER_USER, DELIVER_PASSWORD ------------------------------------------------------------------------------------- The login information you enter will be stored in your Mac OS Keychain More information about that on GitHub: https://github.com/KrauseFx/CredentialsManager ------------------------------------------------------------------------------------- Password (for hoge@fuga.com): ********** INFO Could not find Apple ID based on the app identifier in the US App Store. Maybe the app is not yet in the store? INFO You can provide the Apple ID of your app using `apple_id '974739333'` in your `Deliverfile`
 
 Apple ID of your app (e.g. 284882215): 284882215
 
 INFO Going to download app metadata from iTunesConnect DEBUG [Transporter Output]: INFO: Transporter is searching for updated software components. Init
  22. ERROR [Transporter Error Output]: Your Apple ID or password was

    entered incorrectly. (-20101) It seems like the username or password for the account 'hoge@fuga.com' is wrong. Do you want to re-enter your username and password? (y/n) n DEBUG [Transporter Output]: DBG-X: The error code is: -20101 FATAL Transporter transfer failed. WARN ERROR Your Apple ID or password was entered incorrectly. (-20101) FATAL Return status of iTunes Transporter was 1: Your Apple ID or password was entered incorrectly. (-20101) ERROR Your Apple ID or password was entered incorrectly. (-20101) Return status of iTunes Transporter was 1: Your Apple ID or password was entered incorrectly. (-20101) FATAL Could not download metadata from iTunes Connect. Do you have special characters in your password (Like ' or ")? FATAL Error occured with the setup program! Reverting changes now! INFO Deleting the 'fastlane' folder /Users/hoge/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/deliver-0.7.10/lib/deliver/ app_metadata.rb:302:in `read': No such file or directory @ rb_sysopen - /tmp/968761649.itmsp// metadata.xml (Errno::ENOENT) (ɾ_ɾ;) Your Apple ID or password was entered incorrectly
  23. IPVSTBHP ˏ@ˏ Alpha-numeric password works fine

  24. INFO iTunes Transporter successfully finished its job DEBUG [Transporter Output]:

    DBG-X: Returning 0 INFO Successfully downloaded the latest package from iTunesConnect. INFO Modifying version '1.0.0' of app com.hoge.fuga Successfully created new metadata JSON file at './fastlane//deliver/metadata.json' Successfully created new Deliverfile at './fastlane//Deliverfile' Do you want to setup 'snapshot', which will help you to automatically take screenshots of your iOS app in all languages/devices? (y/n) y INFO Loading up 'snapshot', this might take a few seconds DEBUG Found 10 simulators. Successfully created SnapshotHelper.js './fastlane//SnapshotHelper.js' Successfully created new UI Automation JS file at './fastlane//snapshot.js' Successfully created new UI Automation JS file for iPad at './fastlane//snapshot-iPad.js' Successfully created new Snapfile at './fastlane/Snapfile' Do you want to use 'sigh', which will maintain and download the provisioning profile for your app? (y/n) y INFO 'deliver' enabled. INFO 'snapshot' enabled. INFO 'xctool' not enabled. INFO 'cocoapods' enabled. INFO 'sigh' enabled. INFO Created new file './fastlane/Fastfile'. Edit it to manage your own deployment lanes. INFO Successfully finished setting up fastlane Install
  25. Fastfile

  26. before_all do # ENV["SLACK_URL"] = "https://hooks.slack.com/services/..." # sh "./customShellScript.sh" team_id

    "Q2CBPK58CA"
 cocoapods increment_build_number xctool :test ipa({ workspace: "MyApp.xcworkspace", configuration: "Debug", scheme: "MyApp", }) end before_all
  27. lane :beta do sigh increment_build_number ipa({ workspace: "RSSReader.xcworkspace", configuration: "Release",

    scheme: "RSSReader", clean: "" }) deliver :skip_deploy, :beta end lane
  28. after_all do |lane| slack({ message: "Successfully deployed [App]", success: true,

    channel: 'development' }) end error do |lane, exception| # Something bad happened end after_all
  29. lane :beta do snapshot sigh crashlytics({
 # path to your

    'Crashlytics.framework' crashlytics_path: './Crashlytics.framework', api_token: '...', build_secret: '...', ipa_path: './app.ipa' }) end Crashlytics Beta
  30. lane :beta do snapshot sigh
 deploygate({ api_token: '...', user: 'target

    username or organization name', ipa: './ipa_file.ipa', message: "Build", }) end DeployGate
  31. Snapshot

  32. Snapshot $ snapshot
 
 OR lane :snapshot do snapshot end

    
 
 ./fastlane/Fastfile $ fastlane snapshot
 

  33. Download zip to specify folder

  34. None
  35. Config snapshot & frameit #import "SnapshotHelper.js" var target = UIATarget.localTarget();

    var app = target.frontMostApp(); var window = app.mainWindow(); target.delay(3) captureLocalizedScreenshot("0-LandingScreen") ./fastlane/snapshot.js ./fastlane/Snapfile devices([ "iPhone 6", "iPhone 6 Plus", "iPhone 5", "iPhone 4s", "iPad Air" ]) languages([ "en-US", "de-DE", "es-ES" ]) Device, Language, Timing
  36. AppleTestFlight

  37. Initial setting for versioning

  38. apple_id "9999999999" dir = File.expand_path(File.dirname(__FILE__)) + "/.." ipa do "#{dir}/RSSReader.ipa"

    end beta_ipa do "#{dir}/RSSReader.ipa" end ./fastlane/Deliverfile
  39. Versioning by agvtool

  40. INFO Driving the lane 'beta' INFO Step: team_id INFO Setting

    Team ID to 'xxxxxxxxxx' for all build steps INFO Step: sigh INFO Login into iOS Developer Center INFO Login successful INFO Fetching all available provisioning profiles... INFO Checking if profile is available. (72 profiles found) INFO Downloading profile... INFO Successfully downloaded provisioning profile INFO Exported provisioning profile to '/Users/susieyy/go/src/github.com/wantedly/swift-rss- sample/Distribution_com.susieyy.rss.mobileprovision' INFO open '/Users/susieyy/go/src/github.com/wantedly/swift-rss-sample/ Distribution_com.susieyy.rss.mobileprovision' INFO Step: increment_build_number INFO agvtool next-version -all INFO Step: ipa INFO ipa build -w "RSSReader.xcworkspace" -c "Release" -s "RSSReader" --clean INFO Step: deliver INFO Got all information needed to deploy a new update ('1.0.0') for app 'com.susieyy.rss' INFO Uploading ipa file to iTunesConnect INFO Going to upload updated app to iTunesConnect INFO iTunes Transporter successfully finished its job INFO Successfully uploaded package to iTunesConnect. It might take a few minutes until it's visible online. INFO fastlane.tools finished successfully ./fastlane/Deliverfile $ fastlane beta
 

  41. iTunes Connect

  42. Conclusion ˔/PNBEPJP TIFO[FO ʴ3BLF .BLFͳײ͡ ˔εΫϦʔϯγϣοτͷ࡞੒͸ศར ˔·ͩ·ͩൃల్্ͳͷͰࠓޙΛݟकΓ͍ͨ

  43. ΤϯδχΞืूͯ͠·͢ɿʣ ͓͠·͍