Fastfile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. fastlane_version '2.82.0'
  2. #### Release ####
  3. desc 'Release a new version of VLC to the App Store'
  4. desc ''
  5. desc 'This action requires the following parameters:'
  6. desc '- platform (iOS or tvOS)'
  7. desc ''
  8. desc 'This action does the following:'
  9. desc '- Ensure a clean git status'
  10. desc '- Clear derived data'
  11. desc '- Set the version, bump the build number and commit the change'
  12. desc '- Apply the privateConstants which include the credentials'
  13. desc '- Install cocoapods dependencies'
  14. desc '- Build and sign the app'
  15. desc '- Update the changelog from the NEWS file'
  16. desc '- Push the version bump'
  17. lane :release do |options|
  18. platform = get_platform options
  19. version = get_version options
  20. ensure_git_status_clean
  21. clear_derived_data
  22. set_version_bump_build_and_commit(platform: platform, version: version)
  23. git_apply_private_constants
  24. cocoapods(repo_update: true)
  25. gym(scheme: "VLC-#{platform}")
  26. pilot(app_platform: platform == 'tvOS' ? 'appletvos' : 'ios')
  27. update_changelog
  28. push_to_git_remote
  29. end
  30. #### Private ####
  31. desc 'Bump and commit app version and build number'
  32. private_lane :set_version_bump_build_and_commit do |options|
  33. if options[:platform] == 'tvOS'
  34. increment_build_number_in_plist(VLC::infoPlistPath[:tvOS])
  35. set_version_number_in_plist(VLC::infoPlistPath[:tvOS], options[:version])
  36. elsif options[:platform] == 'iOS'
  37. increment_build_number_in_plist(VLC::infoPlistPath[:iOS])
  38. increment_build_number_in_plist(VLC::infoPlistPath[:watchKitExtension])
  39. increment_build_number_in_plist(VLC::infoPlistPath[:watchOS])
  40. set_version_number_in_plist(VLC::infoPlistPath[:iOS], options[:version])
  41. set_version_number_in_plist(VLC::infoPlistPath[:watchKitExtension], options[:version])
  42. set_version_number_in_plist(VLC::infoPlistPath[:watchOS], options[:version])
  43. end
  44. commit_version_bump(message: 'Version Bump by fastlane', force: true)
  45. end
  46. desc 'Update changelog in iTunes Connect with the content from Docs/NEWS'
  47. private_lane :update_changelog do |options|
  48. # Splits the News by -------- get out the top notes
  49. changelog = File.read('../Docs/NEWS').split('-----------')[1].split('-----------').first
  50. temp_changelog = changelog.split("${options[:platform]}")
  51. if temp_changelog.count <= 1
  52. temp_changelog = changelog.split("tvOS")
  53. end
  54. changelog = temp_changelog[0..-2].join.strip
  55. set_changelog(app_identifier: 'org.videolan.vlc-ios', changelog: changelog, username: '*', team_name: 'VideoLAN')
  56. end
  57. desc 'Apply privateConstants patch including credentials'
  58. private_lane :git_apply_private_constants do
  59. Dir.chdir('..') do
  60. gitapply = `xcrun git apply 0001-privateConstants.patch`
  61. if gitapply != ''
  62. puts("⚠️ There are conflicts. Please resolve the conflicts and update the privateConstants.patch before continuing.\n#{gitapply}")
  63. exit 1
  64. end
  65. end
  66. end
  67. desc 'Return the platform received as parameter, or ask for it if missing'
  68. private_lane :get_platform do |options|
  69. platform = options[:platform]
  70. if !platform || platform.empty?
  71. platform = prompt(text: 'Platform [iOS, tvOS]: ')
  72. end
  73. if platform != 'iOS' && platform != 'tvOS'
  74. puts("⚠️ Platform '#{platform}' not supported")
  75. exit 1
  76. end
  77. platform
  78. end