Class: Fastlane::Actions::MakeReleaseAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/release/actions/make_release_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



76
77
78
# File 'lib/fastlane/plugin/release/actions/make_release_action.rb', line 76

def self.authors
    ["Cole Dunsby"]
end

.available_optionsObject



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/fastlane/plugin/release/actions/make_release_action.rb', line 88

def self.available_options
    [
        FastlaneCore::ConfigItem.new(
            key: :allow_warnings,
            env_name: "ALLOW_WARNINGS",
            default_value: true,
            description: "Allow warnings during pod push",
            optional: true,
            type: Boolean
        ),
        FastlaneCore::ConfigItem.new(
            key: :bump_build,
            env_name: "BUMP_BUILD",
            default_value: false,
            description: "Will increment build number if enabled",
            optional: true,
            type: Boolean
        ),
        FastlaneCore::ConfigItem.new(
            key: :ensure_git_branch,
            env_name: "ENSURE_GIT_BRANCH",
            default_value: "master",
            description: "The branch that should be checked for. String that can be either the full name of the branch or a regex to match",
            optional: true,
            type: String
        ),
        FastlaneCore::ConfigItem.new(
            key: :ensure_git_status_clean,
            env_name: "ENSURE_GIT_STATUS_CLEAN",
            default_value: true,
            description: "Raises an exception if there are uncommitted git changes",
            optional: true,
            type: Boolean
        ),
        FastlaneCore::ConfigItem.new(
            key: :podspec,
            env_name: "PODSPEC",
            description: "The path of the podspec file to update",
            optional: false,
            type: String,
            verify_block: proc do |value|
                UI.user_error!("Could not find podspec at path '#{File.expand_path(value)}'") if !File.exist?(value)
            end
        ),
        FastlaneCore::ConfigItem.new(
            key: :podspec_repo,
            env_name: "PODSPEC_REPO",
            default_value: "Trunk",
            description: "The repo you want to push. Pushes to Trunk by default",
            optional: true,
            type: String
        ),
        FastlaneCore::ConfigItem.new(
            key: :post_bump,
            env_name: "POST_BUMP",
            default_value: false,
            description: "Bump version number after tag and release",
            optional: true,
            type: Boolean
        ),
        FastlaneCore::ConfigItem.new(
            key: :pre_bump,
            env_name: "PRE_BUMP",
            conflicting_options: [:version],
            default_value: false,
            description: "Bump version number before tag and release",
            optional: true,
            type: Boolean
        ),
        FastlaneCore::ConfigItem.new(
            key: :sources,
            env_name: "SOURCES",
            default_value: ["https://github.com/CocoaPods/Specs"],
            description: "The sources of repos you want the pod spec to lint with, separated by commas",
            optional: true,
            type: Array
        ),
        FastlaneCore::ConfigItem.new(
            key: :tag_prefix,
            env_name: "TAG_PREFIX",
            default_value: "",
            description: "A prefix to be added to the version tag (e.g \"v/\")",
            optional: true,
            type: String
        ),
        FastlaneCore::ConfigItem.new(
            key: :version,
            env_name: "VERSION",
            conflicting_options: [:pre_bump, :version_bump_type],
            description: "Change to a specific version. This will replace the bump type value",
            optional: true,
            type: String
        ),
        FastlaneCore::ConfigItem.new(
            key: :version_bump_type,
            env_name: "VERSION_BUMP_TYPE",
            conflicting_options: [:version],
            default_value: "patch",
            description: "The type of this version bump. Available: patch, minor, major",
            optional: true,
            type: String,
            verify_block: proc do |value|
                UI.user_error!("Available values are 'patch', 'minor' and 'major'") unless ['patch', 'minor', 'major'].include?(value)
            end
        ),
        FastlaneCore::ConfigItem.new(
            key: :xcodeproj,
            env_name: "XCODEPROJ",
            description: "The path of the xcode project to update",
            optional: true,
            type: String,
            verify_block: proc do |value|
                UI.user_error!("Could not find xcode project at path '#{File.expand_path(value)}'") if !File.exist?(value)
            end
        )
    ]
end

.bump_version(params, version) ⇒ Object



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
# File 'lib/fastlane/plugin/release/actions/make_release_action.rb', line 27

def self.bump_version(params, version)
    podspec = File.expand_path(params[:podspec])

    if version.nil?
        version = other_action.version_bump_podspec(
            path: podspec,
            bump_type: params[:version_bump_type]
        )
    else
        other_action.version_bump_podspec(
            path: podspec,
            version_number: version
        )
    end

    xcodeproj = File.expand_path(params[:xcodeproj])

    unless xcodeproj.nil?
        other_action.increment_version_number(version_number: version, xcodeproj: xcodeproj)
        other_action.increment_build_number(xcodeproj: xcodeproj) if params[:bump_build]
    end

    other_action.commit_version_bump(include: [params[:podspec]])
    other_action.push_to_git_remote

    version
end

.descriptionObject



72
73
74
# File 'lib/fastlane/plugin/release/actions/make_release_action.rb', line 72

def self.description
    "Automates the steps to create a new release for a framework."
end

.detailsObject



84
85
86
# File 'lib/fastlane/plugin/release/actions/make_release_action.rb', line 84

def self.details
    "Automates the steps to create a new release for a framework."
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


206
207
208
# File 'lib/fastlane/plugin/release/actions/make_release_action.rb', line 206

def self.is_supported?(platform)
    [:ios, :mac].include?(platform)
end

.return_valueObject



80
81
82
# File 'lib/fastlane/plugin/release/actions/make_release_action.rb', line 80

def self.return_value
    "The new version"
end

.run(params) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fastlane/plugin/release/actions/make_release_action.rb', line 10

def self.run(params)
    other_action.ensure_git_branch(branch: params[:ensure_git_branch])
    other_action.ensure_git_status_clean if params[:ensure_git_status_clean]

    if params[:pre_bump]
        version = bump_version(params, params[:version])
    end

    version = tag_and_release(params)

    if params[:post_bump]
        version = bump_version(params, nil)
    end

    version
end

.tag_and_release(params) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/fastlane/plugin/release/actions/make_release_action.rb', line 55

def self.tag_and_release(params)
    podspec = File.expand_path(params[:podspec])
    version = other_action.version_get_podspec(path: podspec)

    other_action.add_git_tag(tag: params[:tag_prefix] + version)
    other_action.push_to_git_remote

    other_action.pod_push(
        path: podspec,
        repo: params[:podspec_repo],
        allow_warnings: params[:allow_warnings],
        sources: params[:sources]
    )

    version
end