Skip to content

Commit 92cd417

Browse files
committed
Update fastlane
1 parent 1def1b2 commit 92cd417

File tree

4 files changed

+134
-58
lines changed

4 files changed

+134
-58
lines changed

RouterX.xcodeproj/project.pbxproj

100755100644
File mode changed.

fastlane/Fastfile

Lines changed: 51 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -16,66 +16,59 @@
1616

1717
# This is the minimum version number required.
1818
# Update this, if you use features of a newer version
19-
fastlane_version "1.63.0"
19+
fastlane_version "1.66.0"
2020

2121
desc "Run all tests"
22-
lane :test do
23-
scan(scheme: "RouterX iOS", clean: true, code_coverage: true)
24-
scan(scheme: "RouterX OSX", clean: true, code_coverage: true)
25-
scan(scheme: "RouterX tvOS", clean: true, code_coverage: true)
26-
27-
Actions.sh("killall Simulator")
28-
end
29-
30-
desc "Build for Carthage"
31-
lane :carthage_lint do
32-
Actions.sh("cd .. && carthage build --no-skip-current && cd fastlane")
33-
end
34-
35-
desc "Lint for Cocoapods"
36-
lane :pod_lint do
37-
Actions.sh("cd .. && pod lib lint && cd fastlane")
38-
end
39-
40-
desc "Lint"
41-
lane :lint do
42-
carthage_lint
43-
pod_lint
44-
end
45-
46-
desc "Release new version"
47-
lane :release do |options|
48-
target_version = options[:version]
49-
raise "The version is missed. Use `fastlane release version:{version_number}`.`" if target_version.nil?
50-
51-
ensure_git_branch
52-
ensure_git_status_clean
53-
54-
test
55-
carthage_lint
56-
57-
sync_build_number_to_git
58-
increment_version_number(version_number: target_version)
59-
version_bump_podspec(path: "RouterX.podspec", version_number: target_version)
60-
61-
log = extract_current_change_log(version: target_version)
62-
release_log = update_change_log(log: log)
63-
64-
git_commit_all(message: "Bump version to #{target_version}")
65-
add_git_tag tag: target_version
66-
67-
push_to_git_remote
68-
69-
set_github_release(
70-
repository_name: "jasl/RouterX",
71-
api_token: ENV['GITHUB_TOKEN'],
72-
name: release_log[:title],
73-
tag_name: target_version,
74-
description: release_log[:text]
75-
)
76-
77-
pod_push
78-
end
22+
lane :test do
23+
scan(scheme: "RouterX iOS", clean: true, code_coverage: true)
24+
scan(scheme: "RouterX OSX", clean: true, code_coverage: true)
25+
scan(scheme: "RouterX tvOS", clean: true, code_coverage: true)
26+
27+
Actions.sh("killall Simulator")
28+
end
29+
30+
desc "Build for Carthage"
31+
lane :carthage_lint do
32+
Actions.sh("cd .. && carthage build --no-skip-current && cd fastlane")
33+
end
34+
35+
desc "Lint for Cocoapods"
36+
lane :pod_lint do
37+
Actions.sh("cd .. && pod lib lint && cd fastlane")
38+
end
39+
40+
desc "Lint"
41+
lane :lint do
42+
carthage_lint
43+
pod_lint
44+
end
45+
46+
desc "Release new version"
47+
lane :release do |options|
48+
target_version = options[:version]
49+
abort "The version is missed. Use `fastlane release version:{version_number}." if target_version.nil?
50+
51+
ensure_git_branch
52+
ensure_git_status_clean
53+
54+
sync_build_number_to_git
55+
increment_version_number(version_number: target_version)
56+
version_bump_podspec(path: "RouterX.podspec", version_number: target_version)
57+
58+
git_commit_all(message: "Bump version to #{target_version}")
59+
add_git_tag tag: target_version
60+
push_to_git_remote
61+
62+
set_github_release(
63+
repository_name: "jasl/RouterX",
64+
api_token: ENV['GITHUB_TOKEN'],
65+
name: target_version,
66+
tag_name: target_version,
67+
description: "RouterX #{target_version}"
68+
)
69+
70+
pod_push
71+
end
7972

8073
# More information about multiple platforms in fastlane: https://github.com/fastlane/fastlane/blob/master/docs/Platforms.md
8174
# All available actions: https://github.com/fastlane/fastlane/blob/master/docs/Actions.md

fastlane/actions/git_commit_all.rb

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
module Fastlane
2+
module Actions
3+
class GitCommitAllAction < Action
4+
def self.run(params)
5+
Actions.sh "git commit -am \"#{params[:message]}\""
6+
end
7+
8+
#####################################################
9+
# @!group Documentation
10+
#####################################################
11+
12+
def self.description
13+
"Commit all unsaved changes to git."
14+
end
15+
16+
def self.available_options
17+
[
18+
FastlaneCore::ConfigItem.new(key: :message,
19+
env_name: "FL_GIT_COMMIT_ALL",
20+
description: "The git message for the commit",
21+
is_string: true)
22+
]
23+
end
24+
25+
def self.authors
26+
# So no one will ever forget your contribution to fastlane :) You are awesome btw!
27+
["onevcat"]
28+
end
29+
30+
def self.is_supported?(platform)
31+
true
32+
end
33+
end
34+
end
35+
end
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
module Fastlane
2+
module Actions
3+
module SharedValues
4+
BUILD_NUMBER = :BUILD_NUMBER
5+
end
6+
class SyncBuildNumberToGitAction < Action
7+
def self.is_git?
8+
Actions.sh 'git rev-parse HEAD'
9+
return true
10+
rescue
11+
return false
12+
end
13+
14+
def self.run(params)
15+
if is_git?
16+
command = 'git rev-list HEAD --count'
17+
else
18+
raise "Not in a git repository."
19+
end
20+
21+
build_number = (Actions.sh command).strip
22+
Fastlane::Actions::IncrementBuildNumberAction.run(build_number: build_number)
23+
Actions.lane_context[SharedValues::BUILD_NUMBER] = build_number
24+
end
25+
26+
def self.output
27+
[
28+
['BUILD_NUMBER', 'The new build number']
29+
]
30+
end
31+
#####################################################
32+
# @!group Documentation
33+
#####################################################
34+
35+
def self.description
36+
"Set the build version of your project to the same number of your total git commit count"
37+
end
38+
39+
def self.authors
40+
["onevcat"]
41+
end
42+
43+
def self.is_supported?(platform)
44+
[:ios, :mac].include? platform
45+
end
46+
end
47+
end
48+
end

0 commit comments

Comments
 (0)