forked from fastlane/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fastfile
111 lines (92 loc) · 3.08 KB
/
Fastfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
fastlane_version "1.0.0"
desc "Build and prepare the app for testing"
lane :build_for_test do
xcodebuild scheme: 'Kiosk', destination: "OS=8.1,name=iPad Air"
end
desc "Run all iOS tests on an iPad"
lane :test do
xctest destination: "OS=8.1,name=iPad Air"
end
desc "Set all the API keys required for distribution"
lane :oss do
keys = ['ArtsyAPIClientSecret',
'ArtsyAPIClientKey',
'HockeyProductionSecret',
'HockeyBetaSecret',
'MixpanelProductionAPIClientKey',
'MixpanelStagingAPIClientKey',
'CardflightAPIClientKey',
'CardflightMerchantAccountToken',
'StripePublishableKey']
commands = keys.map { |key|
command = "bundle exec pod keys set #{key} '-'"
if key == keys.first
command += " Eidolon"
end
command
}.join(' ; ')
sh "cd .. ; #{commands}"
cocoapods
end
desc "Build and prepare deployment"
lane :build_for_deploy do
xcodebuild sdk: "iphoneos", configuration: "release"
end
desc "Release a new beta version on Hockey"
desc "This action does the following:"
desc ""
desc "- Ensures a clean git status"
desc "- Increment the build number"
desc "- Build and sign the app"
desc "- Upload the ipa file to hockey"
desc "- Post a message to slack containing the download link"
desc "- Commit and push the version bump"
lane :deploy do
# Make sure we start off with a clean slate
ensure_git_status_clean
# Increment build number to current date
build_number = Time.new.strftime("%Y.%m.%d")
increment_build_number build_number: build_number
# Set version number to the one at the top of the CHANGELOG
readme = File.read("../docs/CHANGELOG.md")
latest_version = readme.split("\n## ").first
first_line = latest_version.split("\n").first
version_number = first_line.split(" ")[1]
increment_version_number release_task: version_number
# Generate release notes from CHANGELOG
release_notes = latest_version.split("\n")[1..-1].join("\n")
# Build
ipa(
configuration: "Release",
destination: "build",
embed: "fastlane/Distribution_net.artsy.kiosk.beta.mobileprovision",
identity: "iPhone Distribution: ART SY INC",
clean: false,
)
# Push to Hockey
markdown_type = 1
hockey(
api_token: ENV['HOCKEY_API_TOKEN'],
notes_type: markdown_type,
notes: release_notes,
)
# Post message to slack
slack(
message: "There is a new version of the Kiosk app available. Download it at http://artsy.net/kioskbeta",
success: true, # optional, defaults to true
payload: { # optional, lets you specify any number of your own Slack attachments
'Version' => version_number,
'What\'s new' => release_notes,
},
default_payloads: [],
)
# Make sure our directory is clean, except for changes Fastlane has made
clean_build_artifacts
# Tag release and push to GitHub
commit_version_bump message: "Deploying version #{version_number}."
add_git_tag tag: version_number
push_to_git_remote
end
lane :storyboard_ids do
sh "cd .. ; bundle exec sbconstants Kiosk/Storyboards/StoryboardIdentifiers.swift --source-dir Kiosk/Storyboards --swift"
end