This repository has been archived by the owner on Jun 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Fastfile
116 lines (96 loc) · 3.19 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
112
113
114
115
116
fastlane_require 'aws-sdk-kms'
default_platform :ios
platform :ios do
before_all do
setup_circle_ci
end
desc "Prepare dependencies for building app"
lane :prepare_build do |options|
changes = changelog_from_git_commits(pretty: '- %s')
File.write('changelog.txt', changes)
cocoapods
run_linter
update_build_number
push_to_git_remote unless options[:skip_push]
end
desc "Build app"
lane :build do
decrypt_keys
install_signing
build_app
end
desc "Deploy a new build to TestFlight"
lane :beta do |options|
build unless options[:ipa]
changes = File.read('changelog.txt')
upload_to_testflight(
ipa: options[:ipa],
changelog: changes,
)
end
desc "Deploy a new version to the App Store"
lane :deploy do |options|
build unless (options[:ipa] || options[:build_number])
take_screenshots
upload_to_app_store(
submit_for_review: true,
force: true,
ipa: options[:ipa],
app_version: get_version_number(target:'Caronae'),
build_number: options[:build_number],
)
end
desc "Update and install all certificates and provisioning profiles"
lane :update_signing do
sync_code_signing(type: "development", force_for_new_devices: true)
sync_code_signing(type: "appstore")
end
desc "Install all certificates and provisioning profiles"
lane :install_signing do
sync_code_signing(type: "development", readonly: true)
sync_code_signing(type: "appstore", readonly: true)
end
desc "Encrypt sensitive keys using AWS KMS"
lane :encrypt_keys do
kms = Aws::KMS::Client.new()
decrypted_file = IO.read(ENV['GOOGLE_KEYS_FILE'])
encrypted_data = kms.encrypt(key_id: 'alias/caronae-ios-keys', plaintext: decrypted_file)
encrypted_text = Base64.encode64(encrypted_data.ciphertext_blob)
IO.write(ENV['GOOGLE_KEYS_FILE'] + '.encrypted', encrypted_text)
UI.success("Successfully encrypted keys")
end
desc "Decrypt sensitive keys using AWS KMS"
lane :decrypt_keys do
kms = Aws::KMS::Client.new()
encrypted_file = IO.read(ENV['GOOGLE_KEYS_FILE'] + '.encrypted')
encrypted_data = Base64.decode64(encrypted_file)
decrypted_data = kms.decrypt(ciphertext_blob: encrypted_data)
IO.write(ENV['GOOGLE_KEYS_FILE'], decrypted_data.plaintext)
IO.write("../Caronae/Supporting Files/GoogleService-Info.plist", decrypted_data.plaintext)
UI.success("Successfully decrypted keys")
end
desc "Update and tag the version/build"
lane :update_build_number do
build_number = ENV['CIRCLE_BUILD_NUM'] if ENV['CIRCLECI']
increment_build_number(build_number: build_number)
build_number = get_build_number
version_number = get_version_number(target:'Caronae')
tag_name = "#{version_number}/#{build_number}"
add_git_tag(tag: tag_name)
UI.success("Success! New version: #{tag_name}")
end
desc "Take and frame screenshots of the app"
lane :take_screenshots do
capture_ios_screenshots
frame_screenshots(white: true)
end
desc "Run SwiftLint linter and report"
lane :run_linter do
swiftlint(
executable: "Pods/SwiftLint/swiftlint",
config_file: ".swiftlint.yml",
reporter: "emoji",
strict: true
)
end
end