-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathios_codefreeze_prechecks.rb
More file actions
76 lines (62 loc) · 2.96 KB
/
ios_codefreeze_prechecks.rb
File metadata and controls
76 lines (62 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
module Fastlane
module Actions
class IosCodefreezePrechecksAction < Action
def self.run(params)
# fastlane will take care of reading in the parameter and fetching the environment variable:
UI.message "Skip confirm on code freeze: #{params[:skip_confirm]}"
require_relative '../../helper/ios/ios_version_helper'
require_relative '../../helper/ios/ios_git_helper'
# Checkout default branch and update
default_branch = params[:default_branch]
Fastlane::Helper::GitHelper.checkout_and_pull(default_branch)
# Create versions
current_version = Fastlane::Helper::Ios::VersionHelper.get_public_version
current_build_version = Fastlane::Helper::Ios::VersionHelper.get_build_version
next_version = Fastlane::Helper::Ios::VersionHelper.calc_next_release_version(current_version)
# Ask user confirmation
unless params[:skip_confirm] || UI.confirm("Building a new release branch starting from #{default_branch}.\nCurrent version is #{current_version} (#{current_build_version}).\nAfter codefreeze the new version will be: #{next_version}.\nDo you want to continue?")
UI.user_error!('Aborted by user request')
end
# Check local repo status
other_action.ensure_git_status_clean()
# Return the current version
current_version
end
#####################################################
# @!group Documentation
#####################################################
def self.description
'Runs some prechecks before code freeze'
end
def self.details
'Updates the default branch, checks the app version and ensure the branch is clean'
end
def self.available_options
# Define all options your action supports.
[
FastlaneCore::ConfigItem.new(key: :skip_confirm,
env_name: 'FL_IOS_CODEFREEZE_PRECHECKS_SKIPCONFIRM',
description: 'Skips confirmation before codefreeze',
is_string: false, # true: verifies the input is a string, false: every kind of value
default_value: false), # the default value if the user didn't provide one
FastlaneCore::ConfigItem.new(key: :default_branch,
env_name: 'FL_RELEASE_TOOLKIT_DEFAULT_BRANCH',
description: 'Default branch of the repository',
type: String,
default_value: Fastlane::Helper::GitHelper::DEFAULT_GIT_BRANCH),
]
end
def self.output
end
def self.return_value
'Version of the app before code freeze'
end
def self.authors
['Automattic']
end
def self.is_supported?(platform)
[:ios, :mac].include?(platform)
end
end
end
end