Skip to content

Commit 8ded247

Browse files
Merge pull request #29 from michael-patzer/MMC-2039_synchronize_versions
Created `set_version` lane to synchronize versions in the SDK and upd…
2 parents d3a1871 + 0af577f commit 8ded247

File tree

8 files changed

+271
-15
lines changed

8 files changed

+271
-15
lines changed

Changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.1.5] - 2020-04-14
8+
### Added
9+
- `set_version` lane to Fastfile
10+
11+
### Changed
12+
- `release` lane no longer accepts a `version` argument
13+
714
## [0.1.4] - 2020-03-19
815
### Fixed
916
- podspec validation

Gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ GEM
7575
xcodeproj (>= 1.13.0, < 2.0.0)
7676
xcpretty (~> 0.3.0)
7777
xcpretty-travis-formatter (>= 0.0.3)
78+
fastlane-plugin-versioning (0.4.3)
7879
gh_inspector (1.1.3)
7980
google-api-client (0.36.4)
8081
addressable (~> 2.5, >= 2.5.1)
@@ -168,6 +169,7 @@ PLATFORMS
168169

169170
DEPENDENCIES
170171
fastlane (= 2.143.0)
172+
fastlane-plugin-versioning
171173

172174
BUNDLED WITH
173175
2.1.4

MailchimpSDK.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'MailchimpSDK'
11-
s.version = '0.1.4'
11+
s.version = '0.1.5'
1212
s.summary = 'Mailchimp SDK for iOS'
1313

1414
s.description = <<-DESC

MailchimpSDK/Gemfile.lock

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
CFPropertyList (3.0.2)
5+
addressable (2.7.0)
6+
public_suffix (>= 2.0.2, < 5.0)
7+
atomos (0.1.3)
8+
aws-eventstream (1.0.3)
9+
aws-partitions (1.289.0)
10+
aws-sdk-core (3.92.0)
11+
aws-eventstream (~> 1.0, >= 1.0.2)
12+
aws-partitions (~> 1, >= 1.239.0)
13+
aws-sigv4 (~> 1.1)
14+
jmespath (~> 1.0)
15+
aws-sdk-kms (1.30.0)
16+
aws-sdk-core (~> 3, >= 3.71.0)
17+
aws-sigv4 (~> 1.1)
18+
aws-sdk-s3 (1.61.1)
19+
aws-sdk-core (~> 3, >= 3.83.0)
20+
aws-sdk-kms (~> 1)
21+
aws-sigv4 (~> 1.1)
22+
aws-sigv4 (1.1.1)
23+
aws-eventstream (~> 1.0, >= 1.0.2)
24+
babosa (1.0.3)
25+
claide (1.0.3)
26+
colored (1.2)
27+
colored2 (3.1.2)
28+
commander-fastlane (4.4.6)
29+
highline (~> 1.7.2)
30+
declarative (0.0.10)
31+
declarative-option (0.1.0)
32+
digest-crc (0.5.1)
33+
domain_name (0.5.20190701)
34+
unf (>= 0.0.5, < 1.0.0)
35+
dotenv (2.7.5)
36+
emoji_regex (1.0.1)
37+
excon (0.73.0)
38+
faraday (0.17.3)
39+
multipart-post (>= 1.2, < 3)
40+
faraday-cookie_jar (0.0.6)
41+
faraday (>= 0.7.4)
42+
http-cookie (~> 1.0.0)
43+
faraday_middleware (0.13.1)
44+
faraday (>= 0.7.4, < 1.0)
45+
fastimage (2.1.7)
46+
fastlane (2.144.0)
47+
CFPropertyList (>= 2.3, < 4.0.0)
48+
addressable (>= 2.3, < 3.0.0)
49+
aws-sdk-s3 (~> 1.0)
50+
babosa (>= 1.0.2, < 2.0.0)
51+
bundler (>= 1.12.0, < 3.0.0)
52+
colored
53+
commander-fastlane (>= 4.4.6, < 5.0.0)
54+
dotenv (>= 2.1.1, < 3.0.0)
55+
emoji_regex (>= 0.1, < 2.0)
56+
excon (>= 0.71.0, < 1.0.0)
57+
faraday (~> 0.17)
58+
faraday-cookie_jar (~> 0.0.6)
59+
faraday_middleware (~> 0.13.1)
60+
fastimage (>= 2.1.0, < 3.0.0)
61+
gh_inspector (>= 1.1.2, < 2.0.0)
62+
google-api-client (>= 0.29.2, < 0.37.0)
63+
google-cloud-storage (>= 1.15.0, < 2.0.0)
64+
highline (>= 1.7.2, < 2.0.0)
65+
json (< 3.0.0)
66+
jwt (~> 2.1.0)
67+
mini_magick (>= 4.9.4, < 5.0.0)
68+
multi_xml (~> 0.5)
69+
multipart-post (~> 2.0.0)
70+
plist (>= 3.1.0, < 4.0.0)
71+
public_suffix (~> 2.0.0)
72+
rubyzip (>= 1.3.0, < 2.0.0)
73+
security (= 0.1.3)
74+
simctl (~> 1.6.3)
75+
slack-notifier (>= 2.0.0, < 3.0.0)
76+
terminal-notifier (>= 2.0.0, < 3.0.0)
77+
terminal-table (>= 1.4.5, < 2.0.0)
78+
tty-screen (>= 0.6.3, < 1.0.0)
79+
tty-spinner (>= 0.8.0, < 1.0.0)
80+
word_wrap (~> 1.0.0)
81+
xcodeproj (>= 1.13.0, < 2.0.0)
82+
xcpretty (~> 0.3.0)
83+
xcpretty-travis-formatter (>= 0.0.3)
84+
gh_inspector (1.1.3)
85+
google-api-client (0.36.4)
86+
addressable (~> 2.5, >= 2.5.1)
87+
googleauth (~> 0.9)
88+
httpclient (>= 2.8.1, < 3.0)
89+
mini_mime (~> 1.0)
90+
representable (~> 3.0)
91+
retriable (>= 2.0, < 4.0)
92+
signet (~> 0.12)
93+
google-cloud-core (1.5.0)
94+
google-cloud-env (~> 1.0)
95+
google-cloud-errors (~> 1.0)
96+
google-cloud-env (1.3.1)
97+
faraday (>= 0.17.3, < 2.0)
98+
google-cloud-errors (1.0.0)
99+
google-cloud-storage (1.25.1)
100+
addressable (~> 2.5)
101+
digest-crc (~> 0.4)
102+
google-api-client (~> 0.33)
103+
google-cloud-core (~> 1.2)
104+
googleauth (~> 0.9)
105+
mini_mime (~> 1.0)
106+
googleauth (0.11.0)
107+
faraday (>= 0.17.3, < 2.0)
108+
jwt (>= 1.4, < 3.0)
109+
memoist (~> 0.16)
110+
multi_json (~> 1.11)
111+
os (>= 0.9, < 2.0)
112+
signet (~> 0.12)
113+
highline (1.7.10)
114+
http-cookie (1.0.3)
115+
domain_name (~> 0.5)
116+
httpclient (2.8.3)
117+
jmespath (1.4.0)
118+
json (2.3.0)
119+
jwt (2.1.0)
120+
memoist (0.16.2)
121+
mini_magick (4.10.1)
122+
mini_mime (1.0.2)
123+
multi_json (1.14.1)
124+
multi_xml (0.6.0)
125+
multipart-post (2.0.0)
126+
nanaimo (0.2.6)
127+
naturally (2.2.0)
128+
os (1.0.1)
129+
plist (3.5.0)
130+
public_suffix (2.0.5)
131+
representable (3.0.4)
132+
declarative (< 0.1.0)
133+
declarative-option (< 0.2.0)
134+
uber (< 0.2.0)
135+
retriable (3.1.2)
136+
rouge (2.0.7)
137+
rubyzip (1.3.0)
138+
security (0.1.3)
139+
signet (0.13.2)
140+
addressable (~> 2.3)
141+
faraday (>= 0.17.3, < 2.0)
142+
jwt (>= 1.5, < 3.0)
143+
multi_json (~> 1.10)
144+
simctl (1.6.8)
145+
CFPropertyList
146+
naturally
147+
slack-notifier (2.3.2)
148+
terminal-notifier (2.0.0)
149+
terminal-table (1.8.0)
150+
unicode-display_width (~> 1.1, >= 1.1.1)
151+
tty-cursor (0.7.1)
152+
tty-screen (0.7.1)
153+
tty-spinner (0.9.3)
154+
tty-cursor (~> 0.7)
155+
uber (0.1.0)
156+
unf (0.1.4)
157+
unf_ext
158+
unf_ext (0.0.7.6)
159+
unicode-display_width (1.7.0)
160+
word_wrap (1.0.0)
161+
xcodeproj (1.15.0)
162+
CFPropertyList (>= 2.3.3, < 4.0)
163+
atomos (~> 0.1.3)
164+
claide (>= 1.0.2, < 2.0)
165+
colored2 (~> 3.1)
166+
nanaimo (~> 0.2.6)
167+
xcpretty (0.3.0)
168+
rouge (~> 2.0.7)
169+
xcpretty-travis-formatter (1.0.0)
170+
xcpretty (~> 0.2, >= 0.0.7)
171+
172+
PLATFORMS
173+
ruby
174+
175+
DEPENDENCIES
176+
fastlane
177+
178+
BUNDLED WITH
179+
2.1.4

MailchimpSDK/MailchimpSDK.xcodeproj/project.pbxproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@
511511
"@executable_path/Frameworks",
512512
"@loader_path/Frameworks",
513513
);
514-
MARKETING_VERSION = 0.1.4;
514+
MARKETING_VERSION = 0.1.5;
515515
PRODUCT_BUNDLE_IDENTIFIER = com.theRocketScienceGroup.MailchimpSDK;
516516
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
517517
SKIP_INSTALL = YES;
@@ -540,7 +540,7 @@
540540
"@executable_path/Frameworks",
541541
"@loader_path/Frameworks",
542542
);
543-
MARKETING_VERSION = 0.1.4;
543+
MARKETING_VERSION = 0.1.5;
544544
PRODUCT_BUNDLE_IDENTIFIER = com.theRocketScienceGroup.MailchimpSDK;
545545
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
546546
SKIP_INSTALL = YES;
@@ -560,6 +560,7 @@
560560
"@executable_path/Frameworks",
561561
"@loader_path/Frameworks",
562562
);
563+
MARKETING_VERSION = 0.1.5;
563564
PRODUCT_BUNDLE_IDENTIFIER = "com.theRocketScienceGroup.Mailchimp-SDKTests";
564565
PRODUCT_NAME = "$(TARGET_NAME)";
565566
SWIFT_VERSION = 5.0;
@@ -578,6 +579,7 @@
578579
"@executable_path/Frameworks",
579580
"@loader_path/Frameworks",
580581
);
582+
MARKETING_VERSION = 0.1.5;
581583
PRODUCT_BUNDLE_IDENTIFIER = "com.theRocketScienceGroup.Mailchimp-SDKTests";
582584
PRODUCT_NAME = "$(TARGET_NAME)";
583585
SWIFT_VERSION = 5.0;

fastlane/Fastfile

Lines changed: 67 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,24 @@ fastlane_require 'fileutils'
1717

1818
default_platform(:ios)
1919

20-
workspace_name = "MailchimpSDK.xcworkspace"
21-
sdk_scheme_name = "MailchimpSDK"
20+
project_name = "MailchimpSDK"
21+
workspace_name = "#{project_name}.xcworkspace"
22+
sdk_scheme_name = project_name
23+
project_file_path = "#{project_name}/#{project_name}.xcodeproj/"
24+
podspec_path = "#{project_name}.podspec"
2225
build_path = "../build"
2326
deploy_path = "../deploy"
2427
device_archive_path = "#{build_path}/MailchimpDeviceSDK.xcarchive"
2528
simulator_archive_path = "#{build_path}/MailchimpSimulatorSDK.xcarchive"
26-
framework_name = "MailchimpSDK"
27-
xcframework_file_name = "MailchimpSDK.xcframework"
29+
framework_name = project_name
30+
xcframework_file_name = "#{project_name}.xcframework"
2831
xcframework_output_path = "#{build_path}/#{xcframework_file_name}"
2932
deploy_zip = "Mailchimp-SDK-iOS.zip"
3033
changelog_path = "../Changelog.md"
3134
readme_path = "../README.md"
3235
license_path = "../LICENSE"
36+
change_types = %w(Added Changed Deprecated Removed Fixed Security)
37+
changelog_insertion_line = 6
3338

3439
platform :ios do
3540
desc "Builds the SDK framework"
@@ -59,13 +64,10 @@ platform :ios do
5964
sh("cd #{output_path}/#{xcframework_file_name}; find . -name '*.swiftinterface' -exec sed -i -e 's/MailchimpSDK\\.//g' {} \\;")
6065
end
6166

62-
desc "Create a release candidate for a given version"
63-
lane :release do |args|
64-
# Check for version argument
65-
version = args[:version] || ENV['MAILCHIMP_SDK_VERSION'] || marketing_version
66-
if version.nil?
67-
UI.user_error! "Version not provided through argument, environment variable, or release branch name. Try running: `fastlane release version:MAJOR.MINOR.PATCH` or setting the environment variable named MAILCHIMP_SDK_VERSION, where MAJOR.MINOR.PATCH represents the version number."
68-
end
67+
desc "Create a release candidate"
68+
lane :release do
69+
# Always use MARKETING_VERSION for a Release Candidate. Use `set_version` to update MARKETING_VERSION
70+
version = marketing_version
6971

7072
# Clean up previous runs
7173
clean
@@ -105,6 +107,60 @@ platform :ios do
105107
# Remove any previous zipped SDK products
106108
FileUtils.remove_file("../#{deploy_zip}", force = true)
107109
end
110+
111+
desc "Sets the SDK version in all files"
112+
lane :set_version do
113+
version = prompt(text: "Enter version number:").gsub(/^v/, '')
114+
115+
# Set MARKETING_VERSION using `versioning` plugin
116+
increment_version_number_in_xcodeproj(
117+
version_number: version,
118+
xcodeproj: project_file_path
119+
)
120+
UI.message "MARKETING_VERSION updated to #{version}"
121+
122+
version_bump_podspec(path: podspec_path, version_number: version)
123+
UI.message "Podspec version updated to #{version}"
124+
125+
UI.important "You will now update the Changelog. You will be prompted to add entries for any of the available change types. See https://keepachangelog.com/en/1.0.0/ for format."
126+
127+
today = DateTime.now.strftime("%Y-%m-%d")
128+
changelog_changes = ["## [#{version}] - #{today}"]
129+
included_change_type_index = 0 # For keeping track of which change types we include to format empty lines correctly
130+
131+
change_types.each { |type|
132+
input = prompt(text: "Include entry for `#{type}`?", boolean: true)
133+
if (input)
134+
if (included_change_type_index > 0)
135+
changelog_changes << "" # Add an extra line between change type sections
136+
end
137+
138+
included_change_type_index += 1
139+
changelog_changes << "### #{type}" # Add change type title
140+
141+
finished = false
142+
while(!finished)
143+
entry = prompt(text: "Type your entry for `#{type}`: ")
144+
entry = '- ' + entry unless entry.start_with?('-') # Attach the - prefix if needed
145+
changelog_changes << entry # Add line to total changes
146+
147+
additional_input = prompt(text: "Any additional entries for `#{type}`?", boolean: true)
148+
finished = !additional_input # If additional entries is true, we are NOT finished
149+
end
150+
end
151+
}
152+
changelog_changes << "" # Add a trailing new line to separate from previous sections
153+
154+
changelog_lines = File.open(changelog_path).readlines
155+
changelog_lines.insert(changelog_insertion_line, changelog_changes) # Insert the changes
156+
157+
# Write out the Changelog including the additions, line by line
158+
File.open(changelog_path, "w+") do |f|
159+
changelog_lines.each { |element| f.puts(element) }
160+
end
161+
162+
UI.message "#{changelog_path} has been updated."
163+
end
108164
end
109165

110166
def output_path

fastlane/Pluginfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Autogenerated by fastlane
2+
#
3+
# Ensure this file is checked in to source control!
4+
5+
gem 'fastlane-plugin-versioning'

fastlane/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,17 @@ Create Swift Binary Framework
3535
```
3636
fastlane ios release
3737
```
38-
Create a release candidate for a given version
38+
Create a release candidate
3939
### ios clean
4040
```
4141
fastlane ios clean
4242
```
4343
Clean deploy artifacts
44+
### ios set_version
45+
```
46+
fastlane ios set_version
47+
```
48+
Sets the SDK version in all files
4449

4550
----
4651

0 commit comments

Comments
 (0)