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