Commit 0ccd56b3 authored by David Cordero's avatar David Cordero

Define private methods in Fastfile as private lanes. Add support for tvOS...

Define private methods in Fastfile as private lanes. Add support for tvOS releases adding platform parameter
parent f2d72544
def ensure_git_status_clean
gitstatus = `xcrun git status --porcelain`
if gitstatus != "?? 0001-privateConstants.patch\n"
puts("⚠️ There are local changes. Please commit, stash or reset before continuing.\n#{gitstatus}")
exit(-2)
end
fastlane_version '2.82.0'
#### 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 '- Increment the version and build number and commit the change (only for iOS releases)'
desc '- Apply the privateConstants which include the credentials'
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
ensure_git_status_clean
clear_derived_data
bump_version_and_commit if platform == 'iOS'
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
def git_apply_private_constants
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(-2)
end
end
end
#### Private ####
def changelog
#splits the News by -------- get out the top notes
changelog = File.read("../Docs/NEWS").split("-----------")[1].split("-----------").first
tempChangelog = changelog.split("iOS")
if (tempChangelog.count <= 1)
tempChangelog = changelog.split("tvOS")
end
changelog = tempChangelog[0..-2].join.strip
set_changelog(app_identifier: "org.videolan.vlc-ios", changelog: changelog, username: "*", team_name:"VideoLAN")
desc 'Bump and commit app version and build number'
private_lane :bump_version_and_commit do
increment_version_number(bump_type: 'patch')
increment_build_number
commit_version_bump(message: 'Version Bump by fastlane', force: true)
end
def build_app
project_file = 'VLC.xcodeproj'
increment_version_number(
bump_type: "patch",
xcodeproj: project_file
)
increment_build_number(
xcodeproj: project_file)
commit_version_bump(
message: 'Version Bump by fastlane',
xcodeproj: project_file,
force: true)
desc 'Update changelog in iTunes Connect with the content from Docs/NEWS'
private_lane :update_changelog do |options|
# Splits the News by -------- get out the top notes
changelog = File.read('../Docs/NEWS').split('-----------')[1].split('-----------').first
temp_changelog = changelog.split(options[:platform])
if temp_changelog.count <= 1
temp_changelog = changelog.split('tvOS')
end
changelog = temp_changelog[0..-2].join.strip
puts changelog
set_changelog(app_identifier: 'org.videolan.vlc-ios', changelog: changelog, username: '*', team_name: 'VideoLAN')
end
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
default_platform(:ios)
platform :ios do
before_all do
clear_derived_data
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 "Release a new version to the App Store"
desc "This action does the following:"
desc ""
desc "- Ensures a clean git status"
desc "- Increment the version and build number and commit the change"
desc "- Apply the privateConstants which include the credentials"
desc "- Build and sign the app"
desc "- Update the changelog from the NEWS file"
desc "- Push the version bump"
lane :release do
# Make sure we start off with a clean slate
ensure_git_status_clean
# Bumps the version, commits it and builds the app
build_app
#apply the private keys for
git_apply_private_constants
#Build VLC for iOS
gym(workspace: 'VLC.xcworkspace',
scheme: 'VLC-iOS',
clean:true)
# uploads the app to the app store
upload_to_app_store(skip_metadata: true,
skip_screenshots: true)
# updates the changelog from the NEWS file
changelog
push_to_git_remote
desc 'Return the platform received as parameter, or ask for it if missing'
private_lane :get_platform do |options|
platform = options[:platform]
if !platform || platform.empty?
platform = prompt(text: 'Platform [iOS, tvOS]: ')
end
if platform != 'iOS' && platform != 'tvOS'
puts("⚠️ Platform '#{platform}' not supported")
exit 1
end
platform
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment