fastlane-plugin-sunny_project 0.1.10 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/sunny_project/actions/finalize_version_action.rb +14 -15
- data/lib/fastlane/plugin/sunny_project/actions/increase_version_action.rb +7 -7
- data/lib/fastlane/plugin/sunny_project/actions/pubspec_doctor_action.rb +3 -4
- data/lib/fastlane/plugin/sunny_project/actions/release_notes_action.rb +0 -46
- data/lib/fastlane/plugin/sunny_project/actions/sunny_release_action.rb +306 -0
- data/lib/fastlane/plugin/sunny_project/helper/plugin_options.rb +10 -0
- data/lib/fastlane/plugin/sunny_project/helper/sunny_project_helper.rb +91 -5
- data/lib/fastlane/plugin/sunny_project/version.rb +1 -1
- metadata +5 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f9d8a4ec62de4f80f569d04503f9b22f64d942f3115c57057c2ff0a0f6e6ada
|
4
|
+
data.tar.gz: 2877a57f2f83a09512474027fbf1241cf21db2756e7eeb76d22c912ac4e73a46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e670cac6484e54b112043b6710452698d48e4113c21f7c8aaebea653590a3c3115f0e3c6df9e93f6591f37817ac4b321c93458fb5cabb46128c0bcd82965e25
|
7
|
+
data.tar.gz: 45b0e3822537868b51c0a8d5356ec6d528724b0da0ea8cd3041a087ad146396d73351e2bd71947f2db64713f393912fcf1d8e9abda0d7f04ffe310eaaf699fa3
|
@@ -8,15 +8,15 @@ module Fastlane
|
|
8
8
|
version = Sunny.current_semver
|
9
9
|
# If we got this far, let's commit the build number and update the git tags. If the rest of the pro
|
10
10
|
# process fails, we should revert this because it will mess up our commit logs
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
Sunny.run_action(GitCommitAction, path: %w[./pubspec.yaml ./pubspec.lock ./CHANGELOG.md],
|
12
|
+
allow_nothing_to_commit: true,
|
13
|
+
message: "Version bump to: #{version.major}.#{version.minor}.#{version.patch}#800#{version.build}")
|
14
|
+
Sunny.run_action(AddGitTagAction,
|
15
|
+
tag: "sunny/builds/v#{version.build}",
|
16
|
+
force: true,
|
17
|
+
sign: false,
|
18
18
|
)
|
19
|
-
|
19
|
+
Sunny.run_action(PushGitTagsAction, log: true)
|
20
20
|
if File.exist?(Sunny.release_notes_file)
|
21
21
|
File.delete(Sunny.release_notes_file)
|
22
22
|
end
|
@@ -41,13 +41,12 @@ module Fastlane
|
|
41
41
|
|
42
42
|
def self.available_options
|
43
43
|
[
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
44
|
+
FastlaneCore::ConfigItem.new(key: :tag_group,
|
45
|
+
env_name: "SUNNY_PROJECT_TAG_GROUP",
|
46
|
+
description: "The name of the tag group",
|
47
|
+
optional: false,
|
48
|
+
type: String,
|
49
|
+
default_value: "sunny/builds"),
|
51
50
|
|
52
51
|
]
|
53
52
|
end
|
@@ -31,13 +31,13 @@ module Fastlane
|
|
31
31
|
UI.error "Invalid option: #{value} Must be 'build' or 'patch'" unless value == "build" or value == "patch"
|
32
32
|
end
|
33
33
|
[
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
34
|
+
FastlaneCore::ConfigItem.new(key: :type,
|
35
|
+
env_name: "SUNNY_PROJECT_TYPE",
|
36
|
+
description: "Whether to make a patch or build version change",
|
37
|
+
optional: true,
|
38
|
+
verify_block: verify_type,
|
39
|
+
default_value: 'build',
|
40
|
+
type: String)
|
41
41
|
]
|
42
42
|
end
|
43
43
|
|
@@ -48,10 +48,9 @@ module Fastlane
|
|
48
48
|
dependency_overrides = pubspec["dependency_overrides"]
|
49
49
|
|
50
50
|
plugins.keys.each do |key|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
end
|
51
|
+
|
52
|
+
info = plugins[key] ? plugins[key] : "#{key}"
|
53
|
+
|
55
54
|
folder = key
|
56
55
|
branch = nil
|
57
56
|
path = nil
|
@@ -8,53 +8,7 @@ module Fastlane
|
|
8
8
|
|
9
9
|
class ReleaseNotesAction < Action
|
10
10
|
def self.run(options)
|
11
|
-
changes = Sunny.string(options[:changes])
|
12
|
-
if Sunny.blank(changes)
|
13
|
-
if File.file?(Sunny.release_notes_file)
|
14
|
-
changes = Sunny.string(File.read(Sunny.release_notes_file))
|
15
11
|
|
16
|
-
UI.message "Found release notes: \n#####################################################\n\n#{changes}\n\n#####################################################\n"
|
17
|
-
sleep(5)
|
18
|
-
return changes
|
19
|
-
end
|
20
|
-
unless File.file?(Sunny.release_notes_file)
|
21
|
-
changes = Sunny.string(Fastlane::Actions::ChangelogFromGitCommitsAction.run(
|
22
|
-
path: "./",
|
23
|
-
pretty: "%B",
|
24
|
-
ancestry_path: false,
|
25
|
-
match_lightweight_tag: true,
|
26
|
-
quiet: false,
|
27
|
-
merge_commit_filtering: ":exclude_merges"
|
28
|
-
))
|
29
|
-
|
30
|
-
if Sunny.blank(changes)
|
31
|
-
changes = Sunny.string(Fastlane::Actions::PromptAction.run(
|
32
|
-
text: "Please Enter a description of what changed.\nWhen you are finished, type END\n Changelog: ",
|
33
|
-
multi_line_end_keyword: 'END'))
|
34
|
-
end
|
35
|
-
end
|
36
|
-
unless Sunny.blank(changes)
|
37
|
-
File.open(Sunny.release_notes_file, 'w') { |file|
|
38
|
-
file.write(changes)
|
39
|
-
}
|
40
|
-
end
|
41
|
-
if File.file?(Sunny.release_notes_file)
|
42
|
-
changes = Sunny.string(File.read(Sunny.release_notes_file))
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
if File.file?("CHANGELOG.md")
|
47
|
-
f = File.open("CHANGELOG.md", "r+")
|
48
|
-
lines = f.readlines
|
49
|
-
f.close
|
50
|
-
v = Sunny.current_semver
|
51
|
-
lines = ["## [#{v}]\n", " * #{changes}\n", "\n"] + lines
|
52
|
-
|
53
|
-
output = File.new("CHANGELOG.md", "w")
|
54
|
-
lines.each { |line| output.write line }
|
55
|
-
output.close
|
56
|
-
end
|
57
|
-
changes
|
58
12
|
end
|
59
13
|
|
60
14
|
def self.description
|
@@ -0,0 +1,306 @@
|
|
1
|
+
require_relative '../helper/sunny_project_helper'
|
2
|
+
require 'semantic'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
require_relative '../helper/plugin_options'
|
6
|
+
|
7
|
+
def resort_keys(input)
|
8
|
+
resort = {}
|
9
|
+
keys = []
|
10
|
+
input.each_key do |key|
|
11
|
+
puts("Key #{key} #{key.class}")
|
12
|
+
keys.push("#{key}")
|
13
|
+
end
|
14
|
+
|
15
|
+
keys = keys.sort
|
16
|
+
puts("Sorted keys: #{keys}")
|
17
|
+
keys.each do |k|
|
18
|
+
resort[k] = input[k]
|
19
|
+
end
|
20
|
+
resort
|
21
|
+
end
|
22
|
+
|
23
|
+
module Fastlane
|
24
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
25
|
+
module Actions
|
26
|
+
class SunnyReleaseAction < Action
|
27
|
+
def self.run(options)
|
28
|
+
unless options[:skip_dirty_check]
|
29
|
+
Sunny.run_action(EnsureGitStatusCleanAction)
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
sunny_file = Sunny.config(SunnyProject::Options.available_options, {})
|
34
|
+
sunny_file.load_configuration_file("Sunnyfile")
|
35
|
+
|
36
|
+
app_file = CredentialsManager::AppfileConfig
|
37
|
+
firebase_app_id=sunny_file[:firebase_app_id]
|
38
|
+
unless firebase_app_id
|
39
|
+
UI.user_error!("Missing firebase_app_id. Set this in Sunnyfile")
|
40
|
+
end
|
41
|
+
|
42
|
+
old_version = Sunny.current_semver
|
43
|
+
build_number = ''
|
44
|
+
## If we're not going to build, we don't need to update
|
45
|
+
# version numbers.
|
46
|
+
if options[:build] and not options[:no_bump]
|
47
|
+
if options[:release]
|
48
|
+
build_number = Sunny.do_increase_version(build: true, patch: true)
|
49
|
+
else
|
50
|
+
build_number = Sunny.do_increase_version(build: true)
|
51
|
+
end
|
52
|
+
|
53
|
+
unless build_number
|
54
|
+
UI.user_error!("Version incrementing failed")
|
55
|
+
return
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Whatever happened with the incrementing, this is the build number we're
|
60
|
+
# going with
|
61
|
+
version = Sunny.current_semver
|
62
|
+
UI.command_output("Build Version: #{version}")
|
63
|
+
changes = Sunny.release_notes(options)
|
64
|
+
UI.important('--------------- CHANGELOG ------------------')
|
65
|
+
UI.important(changes)
|
66
|
+
UI.important('--------------------------------------------')
|
67
|
+
|
68
|
+
# TRY to execute a build. if it fails, revert the version number changes
|
69
|
+
begin
|
70
|
+
if options[:build]
|
71
|
+
if options[:skip_flutter_build]
|
72
|
+
UI.important "Skipping Flutter Build"
|
73
|
+
else
|
74
|
+
UI.header "Run Flutter Build"
|
75
|
+
Sunny.build_ios(build_number)
|
76
|
+
end
|
77
|
+
require 'match'
|
78
|
+
build_opts = options[:build_options]
|
79
|
+
|
80
|
+
# Load match parameters. The paths get hosed somehow
|
81
|
+
match_opts = Sunny.config(Match::Options.available_options, {
|
82
|
+
type: build_opts[0]
|
83
|
+
})
|
84
|
+
|
85
|
+
match_opts.load_configuration_file("Matchfile")
|
86
|
+
|
87
|
+
UI.header "Read Appfile info"
|
88
|
+
# Read the app identifier from Appfile
|
89
|
+
app_identifier = app_file.try_fetch_value(:app_identifier)
|
90
|
+
UI.command_output "App: #{app_identifier}"
|
91
|
+
unless app_identifier
|
92
|
+
UI.user_error!("No app_identifier could be found")
|
93
|
+
end
|
94
|
+
|
95
|
+
MatchAction.run(match_opts)
|
96
|
+
UI.header "Run Xcode Build"
|
97
|
+
Sunny.run_action(BuildAppAction, workspace: "ios/Runner.xcworkspace",
|
98
|
+
scheme: "Runner",
|
99
|
+
export_method: build_opts[1],
|
100
|
+
silent: options[:verbose] != true,
|
101
|
+
suppress_xcode_output: options[:verbose] != true,
|
102
|
+
clean: options[:clean],
|
103
|
+
export_options: {
|
104
|
+
provisioningProfiles: {
|
105
|
+
"#{app_identifier}" => "match #{build_opts[2]} #{app_identifier}",
|
106
|
+
}
|
107
|
+
},
|
108
|
+
output_directory: "build/ios")
|
109
|
+
|
110
|
+
end
|
111
|
+
rescue StandardError => e
|
112
|
+
# Put the version back like it was
|
113
|
+
UI.important("Restoring old version: #{old_version}")
|
114
|
+
Sunny.override_version(version: old_version)
|
115
|
+
UI.user_error!(">> build ios failed #{e} << \n #{e.backtrace.join("\n")}")
|
116
|
+
return
|
117
|
+
end
|
118
|
+
|
119
|
+
app_name = options[:app_name]
|
120
|
+
# Commits the version number, deletes changelog file
|
121
|
+
if options[:build] or options[:post_build]
|
122
|
+
unless options[:skip_symbols]
|
123
|
+
UI.header "Upload Symbols to Crashlytics"
|
124
|
+
Sunny.run_action(UploadSymbolsToCrashlyticsAction, dsym_path: "./build/ios/#{app_name}.app.dSYM.zip",
|
125
|
+
binary_path: "./ios/Pods/FirebaseCrashlytics/upload-symbols")
|
126
|
+
end
|
127
|
+
|
128
|
+
UI.header "Commit pubspec.yaml, Info.plist for version updates"
|
129
|
+
# If we got this far, let's commit the build number and update the git tags. If the rest of the pro
|
130
|
+
# process fails, we should revert this because it will mess up our commit logs
|
131
|
+
Sunny.run_action(GitCommitAction,
|
132
|
+
allow_nothing_to_commit: true,
|
133
|
+
path: %w[./pubspec.yaml ./pubspec.lock ./Gemfile.lock ./ios/Runner/Info.plist],
|
134
|
+
message: "\"Version bump to: #{version.major}.#{version.minor}.#{version.patch}#800#{version.build}\"")
|
135
|
+
UI.header "Tagging repo v#{version.build}"
|
136
|
+
Sunny.run_action(AddGitTagAction,
|
137
|
+
grouping: "sunny-builds",
|
138
|
+
prefix: "v",
|
139
|
+
force: true,
|
140
|
+
build_number: version.build
|
141
|
+
)
|
142
|
+
Sunny.run_action(PushGitTagsAction, force: false)
|
143
|
+
end
|
144
|
+
|
145
|
+
unless options[:no_upload]
|
146
|
+
|
147
|
+
# platform :ios do
|
148
|
+
release_target = options[:release_target]
|
149
|
+
if release_target == "firebase"
|
150
|
+
UI.header "Firebase: uploading build/ios/#{app_name}.ipa"
|
151
|
+
#require 'fastlane-plugin-firebase_app_distribution'
|
152
|
+
|
153
|
+
Sunny.run_action(FirebaseAppDistributionAction,
|
154
|
+
app: firebase_app_id,
|
155
|
+
ipa_path: "build/ios/#{app_name}.ipa",
|
156
|
+
release_notes: changes,
|
157
|
+
debug: true
|
158
|
+
)
|
159
|
+
elsif release_target == "testflight"
|
160
|
+
UI.header "Testflight: uploading build/ios/#{app_name}.ipa"
|
161
|
+
Sunny.run_action(UploadToTestflightAction,
|
162
|
+
ipa: "build/ios/#{app_name}.ipa",
|
163
|
+
localized_build_info: {
|
164
|
+
default: {
|
165
|
+
whats_new: changes
|
166
|
+
}
|
167
|
+
}
|
168
|
+
)
|
169
|
+
else
|
170
|
+
UI.user_error!("No release target specified. Must be 'testflight' or 'firebase'")
|
171
|
+
return
|
172
|
+
end
|
173
|
+
# end
|
174
|
+
|
175
|
+
end
|
176
|
+
UI.command_output("Removing release notes file")
|
177
|
+
File.delete(Sunny.release_notes_file) if File.exist?(Sunny.release_notes_file)
|
178
|
+
end
|
179
|
+
|
180
|
+
def self.description
|
181
|
+
"Modify pubspec for local or git development"
|
182
|
+
end
|
183
|
+
|
184
|
+
def self.authors
|
185
|
+
["ericmartineau"]
|
186
|
+
end
|
187
|
+
|
188
|
+
def self.return_value
|
189
|
+
# If your method provides a return value, you can describe here what it does
|
190
|
+
end
|
191
|
+
|
192
|
+
def self.details
|
193
|
+
# Optional:
|
194
|
+
""
|
195
|
+
end
|
196
|
+
|
197
|
+
def self.available_options
|
198
|
+
[
|
199
|
+
FastlaneCore::ConfigItem.new(key: :no_bump,
|
200
|
+
env_name: "SUNNY_NO_BUMP",
|
201
|
+
description: "Whether to skip a bump",
|
202
|
+
optional: true, type: Object),
|
203
|
+
FastlaneCore::ConfigItem.new(key: :build,
|
204
|
+
env_name: "SUNNY_BUILD",
|
205
|
+
description: "Whether to perform a complete build",
|
206
|
+
optional: true, type: Object),
|
207
|
+
FastlaneCore::ConfigItem.new(key: :post_build,
|
208
|
+
env_name: "SUNNY_POST_BUILD",
|
209
|
+
description: "Whether to execute actions after building",
|
210
|
+
optional: true, type: Object),
|
211
|
+
FastlaneCore::ConfigItem.new(key: :skip_dirty_check,
|
212
|
+
env_name: "SUNNY_SKIP_DIRTY_CHECK",
|
213
|
+
description: "Whether to skip dirty repo check",
|
214
|
+
optional: true, type: Object),
|
215
|
+
FastlaneCore::ConfigItem.new(key: :clean,
|
216
|
+
env_name: "SUNNY_CLEAN",
|
217
|
+
description: "Whether to do a clean build",
|
218
|
+
optional: true, type: Object),
|
219
|
+
FastlaneCore::ConfigItem.new(key: :release,
|
220
|
+
env_name: "SUNNY_RELEASE",
|
221
|
+
description: "Whether to make a release vs patch build",
|
222
|
+
optional: true, type: Object),
|
223
|
+
FastlaneCore::ConfigItem.new(key: :changelog,
|
224
|
+
env_name: "SUNNY_CHANGELOG",
|
225
|
+
description: "Changelog",
|
226
|
+
optional: true),
|
227
|
+
|
228
|
+
FastlaneCore::ConfigItem.new(key: :no_upload,
|
229
|
+
env_name: "SUNNY_NO_UPLOAD",
|
230
|
+
description: "Whether to skip uploading the build",
|
231
|
+
optional: true, type: Object),
|
232
|
+
|
233
|
+
FastlaneCore::ConfigItem.new(key: :flutter,
|
234
|
+
env_name: "SUNNY_FLUTTER",
|
235
|
+
description: "Override path to flutter",
|
236
|
+
optional: true),
|
237
|
+
|
238
|
+
FastlaneCore::ConfigItem.new(key: :release_target,
|
239
|
+
env_name: "SUNNY_RELEASE_TARGET",
|
240
|
+
description: "Where we're releasing to",
|
241
|
+
optional: false,
|
242
|
+
type: String),
|
243
|
+
|
244
|
+
FastlaneCore::ConfigItem.new(key: :skip_flutter_build,
|
245
|
+
env_name: "SKIP FLUTTER BUILD",
|
246
|
+
description: "Skip the initial flutter build",
|
247
|
+
optional: true,
|
248
|
+
type: Object),
|
249
|
+
FastlaneCore::ConfigItem.new(key: :verbose,
|
250
|
+
env_name: "SUNNY_VERBOSE",
|
251
|
+
description: "Verbose",
|
252
|
+
optional: true,
|
253
|
+
type: Object),
|
254
|
+
|
255
|
+
FastlaneCore::ConfigItem.new(key: :app_name,
|
256
|
+
env_name: "SUNNY_APP_NAME",
|
257
|
+
description: "The name of the ios release target",
|
258
|
+
optional: false,
|
259
|
+
type: String),
|
260
|
+
|
261
|
+
FastlaneCore::ConfigItem.new(key: :skip_symbols,
|
262
|
+
env_name: "SUNNY_SKIP_SYMBOLS",
|
263
|
+
description: "Skip uploading symbols to firebase",
|
264
|
+
optional: true, type: Object),
|
265
|
+
FastlaneCore::ConfigItem.new(key: :build_options,
|
266
|
+
env_name: "SUNNY_BUILD_OPTIONS",
|
267
|
+
description: "A Hash of build options",
|
268
|
+
optional: false,
|
269
|
+
type: Array),
|
270
|
+
|
271
|
+
]
|
272
|
+
end
|
273
|
+
|
274
|
+
def self.is_supported?(platform)
|
275
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
276
|
+
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
277
|
+
#
|
278
|
+
# [:ios, :mac, :android].include?(platform)
|
279
|
+
true
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
class CustomVisitor < Psych::Visitors::Emitter
|
284
|
+
def initialize(io)
|
285
|
+
super(io)
|
286
|
+
end
|
287
|
+
|
288
|
+
def visit_Psych_Nodes_Scalar(o)
|
289
|
+
if o.value.is_a?(String)
|
290
|
+
str = "#{o.value}"
|
291
|
+
if str.start_with?('^') || str.start_with?('..')
|
292
|
+
@handler.scalar(o.value, o.anchor, o.tag, o.plain, o.quoted, 1)
|
293
|
+
elsif str.start_with?('https://') || str.start_with?('git@')
|
294
|
+
@handler.scalar(o.value, o.anchor, o.tag, o.plain, o.quoted, 3)
|
295
|
+
else
|
296
|
+
@handler.scalar(o.value, o.anchor, o.tag, o.plain, o.quoted, o.style)
|
297
|
+
end
|
298
|
+
return
|
299
|
+
end
|
300
|
+
@handler.scalar(o.value, o.anchor, o.tag, o.plain, o.quoted, o.style)
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
@@ -17,6 +17,16 @@ module Fastlane
|
|
17
17
|
description: "The plugins",
|
18
18
|
type: Hash,
|
19
19
|
optional: true,),
|
20
|
+
FastlaneCore::ConfigItem.new(key: :firebase_app_id,
|
21
|
+
env_name: "SUNNY_FIREBASE_APP_ID",
|
22
|
+
description: "Firebase app id",
|
23
|
+
type: String,
|
24
|
+
optional: true,),
|
25
|
+
FastlaneCore::ConfigItem.new(key: :firebase_cli_path,
|
26
|
+
env_name: "SUNNY_FIREBASE_CLI_PATH",
|
27
|
+
description: "Firebase cli path",
|
28
|
+
type: String,
|
29
|
+
optional: true,),
|
20
30
|
FastlaneCore::ConfigItem.new(key: :sunny_plugin_folder,
|
21
31
|
env_name: "SUNNY_PLUGIN_FOLDER",
|
22
32
|
description: "Folder that contains the packages",
|
@@ -21,6 +21,13 @@ module Fastlane
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
def self.config(available_options, options)
|
25
|
+
FastlaneCore::Configuration.create(available_options, options)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.run_action(action, **options)
|
29
|
+
action.run(self.config(action.available_options, options))
|
30
|
+
end
|
24
31
|
|
25
32
|
def self.do_increase_version(options)
|
26
33
|
command = "pubver bump #{options[:type]} "
|
@@ -45,6 +52,7 @@ module Fastlane
|
|
45
52
|
else
|
46
53
|
if args[:cmd_out]
|
47
54
|
UI.command_output name
|
55
|
+
elsif args[:quiet]
|
48
56
|
else
|
49
57
|
UI.command name
|
50
58
|
end
|
@@ -64,6 +72,84 @@ module Fastlane
|
|
64
72
|
Semantic::Version.new current_version_string
|
65
73
|
end
|
66
74
|
|
75
|
+
def self.release_notes(options)
|
76
|
+
changes = Sunny.string(options[:changelog])
|
77
|
+
if Sunny.blank(changes)
|
78
|
+
if File.file?(Sunny.release_notes_file)
|
79
|
+
changes = Sunny.string(File.read(Sunny.release_notes_file))
|
80
|
+
return changes
|
81
|
+
end
|
82
|
+
unless File.file?(Sunny.release_notes_file)
|
83
|
+
changes = Sunny.string(Fastlane::Actions::ChangelogFromGitCommitsAction.run(
|
84
|
+
path: "./",
|
85
|
+
pretty: "%B",
|
86
|
+
ancestry_path: false,
|
87
|
+
match_lightweight_tag: true,
|
88
|
+
quiet: false,
|
89
|
+
merge_commit_filtering: ":exclude_merges"
|
90
|
+
))
|
91
|
+
|
92
|
+
if Sunny.blank(changes)
|
93
|
+
changes = Sunny.string(Fastlane::Actions::PromptAction.run(
|
94
|
+
text: "Please Enter a description of what changed.\nWhen you are finished, type END\n Changelog: ",
|
95
|
+
multi_line_end_keyword: 'END'))
|
96
|
+
end
|
97
|
+
end
|
98
|
+
unless Sunny.blank(changes)
|
99
|
+
File.open(Sunny.release_notes_file, 'w') { |file|
|
100
|
+
file.write(changes)
|
101
|
+
}
|
102
|
+
end
|
103
|
+
if File.file?(Sunny.release_notes_file)
|
104
|
+
changes = Sunny.string(File.read(Sunny.release_notes_file))
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
if File.file?("CHANGELOG.md")
|
109
|
+
f = File.open("CHANGELOG.md", "r+")
|
110
|
+
lines = f.readlines
|
111
|
+
f.close
|
112
|
+
v = Sunny.current_semver
|
113
|
+
lines = ["## [#{v}]\n", " * #{changes}\n", "\n"] + lines
|
114
|
+
|
115
|
+
output = File.new("CHANGELOG.md", "w")
|
116
|
+
lines.each { |line| output.write line }
|
117
|
+
output.close
|
118
|
+
end
|
119
|
+
changes
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.get_flutter(provided = nil)
|
123
|
+
provided || ".fvm/flutter_sdk/bin/flutter"
|
124
|
+
end
|
125
|
+
|
126
|
+
def self.override_version(**options)
|
127
|
+
semver = options[:version]
|
128
|
+
unless semver
|
129
|
+
UI.user_error! "No version parameter found"
|
130
|
+
return
|
131
|
+
end
|
132
|
+
self.exec_cmd("set_version", "pubver set #{semver}", quiet: true)
|
133
|
+
self.sync_version_number(semver)
|
134
|
+
end
|
135
|
+
|
136
|
+
def self.sync_version_number(version)
|
137
|
+
if version
|
138
|
+
self.run_action(Fastlane::Actions::IncrementVersionNumberAction,
|
139
|
+
version_number: "#{version.major}.#{version.minor}.#{version.patch}",
|
140
|
+
xcodeproj: "ios/Runner.xcodeproj"
|
141
|
+
)
|
142
|
+
else
|
143
|
+
UI.user_error! "No version found"
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
|
148
|
+
def self.build_ios(build_num, **options)
|
149
|
+
flutter = get_flutter(options[:flutter])
|
150
|
+
self.exec_cmd("build flutter ios release #{build_num}", "#{flutter} build ios --release --no-tree-shake-icons --no-codesign --build-number=#{build_num}")
|
151
|
+
end
|
152
|
+
|
67
153
|
### Reads the latest version from pubspec.yaml
|
68
154
|
def self.current_semver_path
|
69
155
|
version = nil
|
@@ -79,7 +165,7 @@ module Fastlane
|
|
79
165
|
|
80
166
|
## Retrieves the current semver based on git tags
|
81
167
|
def self.current_version_string
|
82
|
-
self.exec_cmd("get version", "pubver get")
|
168
|
+
self.exec_cmd("get version", "pubver get", quiet: true)
|
83
169
|
end
|
84
170
|
|
85
171
|
# lane :ximg do |options|
|
@@ -108,10 +194,10 @@ module Fastlane
|
|
108
194
|
|
109
195
|
def self.underscore(str)
|
110
196
|
str.gsub(/::/, '/').
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
197
|
+
gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
|
198
|
+
gsub(/([a-z\d])([A-Z])/, '\1_\2').
|
199
|
+
tr("-", "_").
|
200
|
+
downcase
|
115
201
|
end
|
116
202
|
end
|
117
203
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-sunny_project
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ericmartineau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: ci
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: pry
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,14 +128,14 @@ dependencies:
|
|
142
128
|
requirements:
|
143
129
|
- - ">="
|
144
130
|
- !ruby/object:Gem::Version
|
145
|
-
version: 2.
|
131
|
+
version: 2.169.0
|
146
132
|
type: :development
|
147
133
|
prerelease: false
|
148
134
|
version_requirements: !ruby/object:Gem::Requirement
|
149
135
|
requirements:
|
150
136
|
- - ">="
|
151
137
|
- !ruby/object:Gem::Version
|
152
|
-
version: 2.
|
138
|
+
version: 2.169.0
|
153
139
|
description:
|
154
140
|
email: smartytime@gmail.com
|
155
141
|
executables: []
|
@@ -168,6 +154,7 @@ files:
|
|
168
154
|
- lib/fastlane/plugin/sunny_project/actions/pubspec_doctor_action.rb
|
169
155
|
- lib/fastlane/plugin/sunny_project/actions/release_notes_action.rb
|
170
156
|
- lib/fastlane/plugin/sunny_project/actions/rename_assets_action.rb
|
157
|
+
- lib/fastlane/plugin/sunny_project/actions/sunny_release_action.rb
|
171
158
|
- lib/fastlane/plugin/sunny_project/helper/plugin_options.rb
|
172
159
|
- lib/fastlane/plugin/sunny_project/helper/sunny_project_helper.rb
|
173
160
|
- lib/fastlane/plugin/sunny_project/version.rb
|