Skip to content

Commit d8cdc3a

Browse files
authored
bump version to v2.1.2 (#638)
* bump version to v2.1.2 * embed current build number in beta version codes
1 parent 2c271f7 commit d8cdc3a

File tree

7 files changed

+69
-14
lines changed

7 files changed

+69
-14
lines changed

android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ android {
9696
minSdkVersion 16
9797
targetSdkVersion 22
9898
versionCode 1
99-
versionName "2.1.1"
99+
versionName "2.1.2"
100100
ndk {
101101
abiFilters "armeabi-v7a", "x86"
102102
}

fastlane/Fastfile

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ platform :ios do
5050

5151
go_rogue
5252

53-
increment_build_number(
54-
build_number: get_version(platform: 'iOS'),
55-
xcodeproj: "./ios/AllAboutOlaf.xcodeproj",
56-
)
53+
version = get_current_bundle_version(platform: "iOS")
54+
build_number = get_build_number(platform: "iOS")
55+
increment_version_number(version_number: "#{version}.#{build_number}", xcodeproj: "./ios/AllAboutOlaf.xcodeproj")
56+
increment_build_number(build_number: build_number, xcodeproj: "./ios/AllAboutOlaf.xcodeproj")
5757

5858
# Build the app
5959
gym
@@ -143,10 +143,11 @@ end
143143
platform :android do
144144
desc "Makes a build"
145145
lane :build do
146-
set_version_code(
147-
version_code: get_version(platform: "Android"),
148-
gradle_path: "./android/app/build.gradle",
149-
)
146+
version = get_current_bundle_version(platform: "Android")
147+
build_number = get_build_number(platform: "Android")
148+
149+
set_version_name(version_name: "#{version}.#{build_number}", gradle_path: "android/app/build.gradle")
150+
set_version_code(version_code: build_number, gradle_path: "./android/app/build.gradle")
150151

151152
gradle(
152153
task: "assemble",
@@ -220,7 +221,7 @@ private_lane :get_hockeyapp_version_commit do |options|
220221
end
221222

222223
desc "Gets the version, either from Travis or from Hockey"
223-
private_lane :get_version do |options|
224+
private_lane :get_build_number do |options|
224225
ENV["TRAVIS_BUILD_NUMBER"] || get_hockeyapp_version(platform: options[:platform]) + 1
225226
end
226227

@@ -230,3 +231,11 @@ private_lane :build_notes do |options|
230231
changelog = make_changelog(platform: options[:platform])
231232
"branch: #{branch}\ngit commit: #{sha}\n\n## Changelog\n#{changelog}"
232233
end
234+
235+
private_lane :get_current_bundle_version do |options|
236+
if options[:platform] == 'Android'
237+
get_version_name(gradle_path: "android/app/build.gradle")
238+
elsif options[:platform] == 'iOS'
239+
get_info_plist_value(path: "ios/AllAboutOlaf/Info.plist", key: "CFBundleShortVersionString")
240+
end
241+
end
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
module Fastlane
2+
module Actions
3+
class GetVersionNameAction < Action
4+
def self.run(params)
5+
gradle_path = params[:gradle_path]
6+
version_name = nil
7+
8+
File.foreach(gradle_path) do |line|
9+
if line.include? "versionName "
10+
components = line.strip.split(" ")
11+
version_name = components[1].tr("\"","")
12+
end
13+
end
14+
15+
if version_name == nil
16+
UI.user_error!("Impossible to find the version name in the current gradle file #{gradle_path}")
17+
else
18+
UI.success("Version name found: #{version_name}")
19+
end
20+
21+
version_name
22+
end
23+
24+
def self.description
25+
"Get the version name of your android project."
26+
end
27+
28+
def self.authors
29+
["Hawken Rives"]
30+
end
31+
32+
def self.available_options
33+
[
34+
FastlaneCore::ConfigItem.new(key: :gradle_path,
35+
env_name: "GETVERSIONNAME_GRADLE_PATH",
36+
description: "The path to the build.gradle file",
37+
type: String),
38+
]
39+
end
40+
41+
def self.is_supported?(platform)
42+
[:android].include?(platform)
43+
end
44+
end
45+
end
46+
end

ios/All About Olaf UI Tests/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>BNDL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>2.1.1</string>
18+
<string>2.1.2</string>
1919
<key>CFBundleVersion</key>
2020
<string>1</string>
2121
</dict>

ios/AllAboutOlaf/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>2.1.1</string>
18+
<string>2.1.2</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleURLTypes</key>

ios/AllAboutOlafTests/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>BNDL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>2.1.1</string>
18+
<string>2.1.2</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "AllAboutOlaf",
3-
"version": "2.1.1",
3+
"version": "2.1.2",
44
"private": true,
55
"scripts": {
66
"android": "react-native run-android",

0 commit comments

Comments
 (0)