SHARE
TWEET

Untitled

a guest May 23rd, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Fastfile
  2. #
  3. # Author: Ronaldo Lima <ronal2do@gmail.com>
  4. #
  5. # -----------------------------------------------------------
  6. #
  7. # Version bumping, the default type is `patch`
  8. #   Run:
  9. #     `fastlane ios bump`
  10. #     `fastlane ios beta [type:major|minor|patch]`
  11. #
  12. # -----------------------------------------------------------
  13. #
  14. # Deploying to TestFlight:
  15. #   Running this command will result in a `patch` version:
  16. #     `fastlane ios beta`
  17. #
  18. # -----------------------------------------------------------
  19. #
  20. # Deploying to iTunes Store
  21. #   Run:
  22. #     `fastlane ios release`
  23. #
  24.  
  25. # Requires
  26. require 'yaml'
  27. require 'ostruct'
  28.  
  29. # Fastlane defaults
  30. fastlane_version '2.41.0'
  31. default_platform :ios
  32.  
  33. # Fastlane configuration data
  34. config = OpenStruct.new(
  35.   YAML.load_file('fastlane_config.yml')
  36. )
  37.  
  38. # Configuration for iOS
  39. # Available lanes: `beta` and `release`
  40. platform :ios do
  41.  
  42.   # This command will run before all lanes,
  43.   # it will install all dependencies from cocoapods
  44.   # and will configure the slack url from `fastlane_config.yml`
  45.   before_all do
  46.     ENV['SLACK_URL'] = config.slack_url
  47.   end
  48.  
  49.   # Lane: bump
  50.   # It will push to bitbucket a commit with an app's
  51.   #incremented version
  52.   desc 'Bumps the current version of the App'
  53.   lane :bump do |options|
  54.     # Increment current version of the app
  55.     version = increment_version_number_in_plist(
  56.       target: config.target,
  57.       bump_type: options[:bump_type] || 'patch'
  58.     )
  59.  
  60.     # Create version bump commit
  61.     commit_version_bump(
  62.       message: "[Fastlane] Version Bump: #{version}",
  63.       xcodeproj: config.xcodeproj,
  64.       force: true
  65.     )
  66.  
  67.     # Push bump commit to current branch
  68.     push_to_git_remote(
  69.       local_branch: git_branch,
  70.       force: true
  71.     )
  72.   end
  73.  
  74.   # Lane: beta
  75.   # Responsible to deploy a new version of the app
  76.   # to iTunesConnect and make it available to TestFlight
  77.   desc 'Submit a new Beta Build to Apple TestFlight'
  78.   lane :beta do
  79.     # Install pods
  80.     cocoapods
  81.  
  82.     # Sync certificates
  83.     match(
  84.       type: "appstore",
  85.       git_url: config.git_certificates_url,
  86.       readonly: true
  87.     )
  88.  
  89.     disable_automatic_code_signing(path: config.xcodeproj)
  90.  
  91.     # Create a build of the app
  92.     gym(
  93.       scheme: config.scheme
  94.     )
  95.  
  96.     enable_automatic_code_signing(path: config.xcodeproj)
  97.  
  98.     # Push the build to itunes connect
  99.     pilot(
  100.       skip_waiting_for_build_processing: true
  101.     )
  102.  
  103.     # upload_symbols_to_bugsnag # Upload dSYM files to Bugsnag
  104.  
  105.     # Slack notification
  106.     slack(
  107.       message: config.beta_success,
  108.       success: true,
  109.       default_payloads: [:lane, :test_result, :git_branch, :git_author]
  110.     )
  111.   end
  112.  
  113.   # Lane: release
  114.   # Resposible to create a new release of the app
  115.   # and deploy to App Store
  116.   desc 'Deploy a new version to the App Store'
  117.   lane :release do
  118.     # Install pods
  119.     cocoapods
  120.  
  121.     # Sync certificates
  122.     match(
  123.       type: 'appstore',
  124.       git_url: config.git_certificates_url
  125.     )
  126.  
  127.     # Take automized localized screenshots
  128.     #snapshot
  129.  
  130.     # Create a build of the app
  131.     gym
  132.  
  133.     # Upload screenshots, metadata, and the app to the App Store
  134.     deliver(force: true)
  135.  
  136.     # Slack notification
  137.     slack(
  138.       message: config.release_success,
  139.       success: true,
  140.       default_payloads: [:lane, :test_result, :git_branch, :git_author]
  141.     )
  142.   end
  143.  
  144.   # Error handling
  145.   error do |lane, exception|
  146.  
  147.     # Slack notification
  148.     # slack(
  149.     #   message: exception.message,
  150.     #   success: false
  151.     # )
  152.   end
  153. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top