123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- fastlane_version '2.82.0'
- require './helpers/VLC.rb'
- require './helpers/version.rb'
- #### Release ####
- desc 'Release a new version of VLC to the App Store'
- desc ''
- desc 'This action requires the following parameters:'
- desc '- platform (iOS or tvOS)'
- desc ''
- desc 'This action does the following:'
- desc '- Ensure a clean git status'
- desc '- Clear derived data'
- desc '- Set the version, bump the build number and commit the change'
- desc '- Apply the privateConstants which include the credentials'
- desc '- Install cocoapods dependencies'
- desc '- Build and sign the app'
- desc '- Update the changelog from the NEWS file'
- desc '- Push the version bump'
- lane :release do |options|
- platform = get_platform options
- version = get_version options
- ensure_git_status_clean
- clear_derived_data
- set_version_bump_build_and_commit(platform: platform, version: version)
- git_apply_private_constants
- cocoapods(repo_update: true)
- gym(scheme: "VLC-#{platform}")
- pilot(app_platform: platform == 'tvOS' ? 'appletvos' : 'ios')
- update_changelog
- push_to_git_remote
- end
- desc 'Check style and conventions'
- lane :lint do
- rubocop
- swiftlint(executable: 'Pods/SwiftLint/swiftlint', strict: true)
- end
- lane :ci do
- lint
- xcversion(version: '9.2.0')
- xcode_select '/Applications/Xcode.app'
- # Ideally we have iOS 9 support here but this is not yet added
- # https://discuss.circleci.com/t/please-add-simulators-for-ios-9-10-to-xcode-9-image/16530
- xcodebuild(
- workspace: 'VLC.xcworkspace',
- scheme: 'VLC-iOS',
- configuration: 'Debug',
- clean: true,
- build: true,
- destination: 'platform=iOS Simulator,name=iPhone 6s,OS=10.3.1'
- )
- xcodebuild(
- workspace: 'VLC.xcworkspace',
- scheme: 'VLC-tvOS',
- configuration: 'Debug',
- clean: true,
- build: true,
- destination: 'platform=tvOS Simulator,name=Apple TV 1080p,OS=10.2'
- )
- test
- end
- #### Tests ####
- desc 'Run Tests'
- lane :test do
- cocoapods(repo_update: true)
- scan(scheme: 'VLC-iOS')
- end
- #### Private ####
- desc 'Bump and commit app version and build number'
- private_lane :set_version_bump_build_and_commit do |options|
- if options[:platform] == 'tvOS'
- increment_build_number_in_plist(VLC.info_plist_path[:tvOS])
- set_version_number_in_plist(VLC.info_plist_path[:tvOS], options[:version])
- elsif options[:platform] == 'iOS'
- increment_build_number_in_plist(VLC.info_plist_path[:iOS])
- increment_build_number_in_plist(VLC.info_plist_path[:watchKitExtension])
- increment_build_number_in_plist(VLC.info_plist_path[:watchOS])
- set_version_number_in_plist(VLC.info_plist_path[:iOS], options[:version])
- set_version_number_in_plist(VLC.info_plist_path[:watchKitExtension], options[:version])
- set_version_number_in_plist(VLC.info_plist_path[:watchOS], options[:version])
- end
- commit_version_bump(message: 'Version Bump by fastlane', force: true)
- end
- desc 'Update changelog in iTunes Connect with the content from Docs/NEWS'
- private_lane :update_changelog do |options|
- platform = options[:platform]
- # Splits the News by -------- get out the top notes
- changelog = File.read('../Docs/NEWS').split('-----------')[1].split('-----------').first
- temp_changelog = changelog.split(platform)
- temp_changelog = changelog.split('tvOS') if temp_changelog.count <= 1
- changelog = temp_changelog[0..-2].join.strip
- set_changelog(app_identifier: 'org.videolan.vlc-ios', changelog: changelog, username: '*', team_name: 'VideoLAN')
- end
- desc 'Apply privateConstants patch including credentials'
- private_lane :git_apply_private_constants do
- Dir.chdir('..') do
- gitapply = `xcrun git apply 0001-privateConstants.patch`
- if gitapply != ''
- puts("⚠️ There are conflicts. Please resolve the conflicts and update the privateConstants.patch before continuing.\n#{gitapply}")
- exit 1
- end
- end
- end
- desc 'Return the platform received as parameter, or ask for it if missing'
- private_lane :get_platform do |options|
- platform = options[:platform]
- platform = prompt(text: 'Platform [iOS, tvOS]: ') if !platform || platform.empty?
- if platform != 'iOS' && platform != 'tvOS'
- puts("⚠️ Platform '#{platform}' not supported")
- exit 1
- end
- platform
- end
- desc 'Return the version received as parameter, or ask for it if missing'
- private_lane :get_version do |options|
- version = options[:version]
- version = ask('Enter a new version number: ') if !version || version.empty?
- version
- end
|