Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Automate iOS Deployment Using Hamper and Schezhen

Automate iOS Deployment Using Hamper and Schezhen

The talk I gave at ModevCon 2014 about how to automate the iOS distribution process (app provisioning, archiving, and deployment).

Kiran Panesar

December 12, 2014
Tweet

More Decks by Kiran Panesar

Other Decks in Programming

Transcript

  1. AU T O M AT I N G I O

    S D E P L OY M E N T K I R A N PA N E S A R @ K _ PAN E S A R
  2. I ’ M T H E C T O O

    F M O BI L E X L A B S , A N D W E M A K E NAT I V. C O M .
  3. W E ’ RE I N BE TA . B

    E N I C E . K I R AN @ M O B I L E X LAB S . C O M
  4. I O S AU T O M AT I O

    N I S G RE AT. xcodebuild - Jenkins - ios-sim - UIAutomation - TestFlight’s API - etc
  5. T H IS M A K E S I O

    S D E V E L O PM E N T FA ST A N D F U N !
  6. B U T , W H AT A B O

    U T D E PL OY M E N T ?
  7. 1. Sign into the Provisioning Portal. 2. Create an app

    ID. 3. Create a distribution certificate. 4. Install distribution certificate. 5. Create provisioning profile. 6. Download and install profile. 7. Fight with Xcode’s profile management for some time. 8. Tell Xcode to use the profile for distribution. 9. Build. 10. Export archive. 11. Upload to TestFlight, App Store, HockeyApp, etc. ( D E LI B E R AT E LY S MAL L )
  8. T H I S M A K ES I O

    S D E VE L O PM E N T S L O W A N D D U L L .
  9. – Y O U I D O N ’ T

    D O T H I S V E RY O F T E N . W H Y D O I C A RE ?
  10. P E O P L E D O N ’

    T C A RE E N O U G H A B O U T I T. B U T T H E Y A LWAYS C O M P L A I N .
  11. T H IS I S A RE A L PRO

    BL E M F O R US .
  12. N O PRO V ISI O N I N G

    P O RTA L A P I .
  13. I N T RO D U C I N G

    H A M P E R . G I T H U B . C O M / M O B I L E X L A B S / HA M P E R
  14. A C O M M A N D L I

    N E I N T E RFAC E F O R I O S PRO V ISI O N I N G G I T H U B . C O M / M O B I L E X L A B S / HA M P E R
  15. H OW D O E S I T W O

    RK ? Python, Selenium, PhantomJS
  16. W H AT C A N I T D O

    ? • Authentication. • App ID registration. • Certificate generation. • Provisioning profile creation.
  17. I N STA L L AT I O N brew

    install phantomjs ... sudo pip install hampercli
  18. L E T ’ S S E E W H

    AT I T C A N D O .
  19. SI G N I N hamper auth login --email [email protected]

    --password passwd Authenticating user... User successfully authenticated. (Password stored in the device’s keychain for future requests)
  20. A PP I D RE G I ST R AT

    I O N hamper identifier create --app_name MyApp --bundle_id com.mxl.new_app Generating app ID... App ID successfully generated.
  21. C E RT I F I C AT E G

    E N E RAT I O N hamper cert create distribution --csr_path /request.csr --cert_path /out.cer --bundle_id com.mxl.new_app ... Generating certificate (this could take a minute)... Certificate successfully generated. Downloading certificate (this could take a minute)... Certificate successfully downloaded (/Users/kiran/out.cer). openssl genrsa -out private.key 2048 openssl req -new -key private.key -out request.csr Using openssl to generate key and CSR Generate a certificate
  22. PRO V I SI O N I N G P

    RO F I L E C RE AT I O N ... Waiting for Apple to generate profile (this could take a minute)... Provisioning profile successfully generated. Downloading provisioning profile... Profile successfully downloaded (/Users/kiran/p.mobileprovision). hamper profile create app_store --name MyApp_Production --bundle_id com.kp.my_app --profile_path p.mobileprovision --exp_day 20 --exp_month 04 --exp_year 2015
  23. – Y O U W H AT C A N

    I D O W I T H T H IS ?
  24. T O T H E A PP ST O RE

    ! Using Hamper with Shenzhen (Mattt Thompson)
  25. RE G IST E R A N A PP hamper

    identifier create --app_name MyApp --bundle_id com.mxl.new_app Generating app ID... App ID successfully generated.
  26. G E N E RAT E T H E P

    RO F I L E Waiting for Apple to generate profile (this could take a minute)... Provisioning profile successfully generated. Downloading provisioning profile... Profile successfully downloaded (/Users/kiran/p.mobileprovision). hamper profile create app_store --name MyApp_Production --bundle_id com.mxl.new_app --profile_path p.mobileprovision --exp_day 20 --exp_month 04 --exp_year 2015
  27. I N STA L L T H E P RO

    F I L E uuid=`grep UUID -A1 -a p.mobileprovision | grep -io "[-A-Z0-9]\{36\}"` cp p.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/$uuid.mobileprovision H O L D O N T O T H AT U U I D , W E ’ RE G O I N G T O N E E D I T I N T H E N E X T S T E P
  28. B U I L D A N D A RC

    H I VE xcodebuild archive -workspace my_app.xcworkspace -scheme MyApp -archivePath output.xcarchive PROVISIONING_PROFILE=$uuid xcodebuild -exportArchive -archivePath output.xcarchive -exportPath ./ -exportFormat ipa -exportProvisioningProfile p.mobileprovision
  29. U PL OA D ! ipa distribute:itunesconnect -a [email protected] -p

    passwd -i 234234235 --upload U S I N G S H E N Z H E N
  30. W H AT ’ S N E X T ?

    • Prompting interface. • Integration with openssl to generate CSRs. • Integration with iTunes Connect to create an app, fill out metadata. • General reliability improvements. B E CAU S E I T ’ S I N B E TA .
  31. T H A N K S ! G I T

    H U B . C O M / M O B I L E X LAB S / HAM P E R
  32. K I RA N PA N ES A R E

    N G I N E E R I N G . M O B I L E X LAB S . C O M @ K _ PAN E SAR K I R AN @ M O B I L E X LAB S . C O M