status-mobile/fastlane/Fastfile

224 lines
6.2 KiB
Plaintext
Raw Normal View History

# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# There are a few env variables defined in the .env file in
# this directory (fastlane/.env)
# unlocks keychain if KEYCHAIN_PASSWORD variable is present
# (to be used on CI machines)
def unlock_keychain_if_needed
if ENV["KEYCHAIN_PASSWORD"]
unlock_keychain(
path:"login.keychain",
password:ENV["KEYCHAIN_PASSWORD"],
set_default: true)
end
end
# builds an ios app with ad-hoc configuration and put it
# to "status-adhoc" output folder
def build_ios_adhoc
match(
type: "adhoc",
force_for_new_devices: true,
readonly: true,
keychain_name: "login.keychain"
)
build_ios_app(
scheme: "StatusIm",
workspace: "ios/StatusIm.xcworkspace",
configuration: "Release",
clean: true,
export_method: "ad-hoc",
output_directory: "status-adhoc"
)
end
def notify_about_new_build(source, url)
msg = "Branch: " + ENV["BRANCH_NAME"] + ", "
if source.end_with? ".ipa"
msg = msg + "iOS build uploaded to diawi: " + url
else
msg = msg + "Android build uploaded to diawi: " + url
end
slack(
message: msg,
slack_url: ENV["SLACK_URL"]
)
github_api(
server_url: "https://api.github.com",
api_token: ENV["GITHUB_TOKEN"],
http_method: "POST",
path: "/repos/status-im/status-react/issues/" + ENV["CHANGE_ID"] + "/comments",
body: {
"body": msg
}
)
end
def upload_to_diawi_and_notify(source)
diawi(
token: ENV["DIAWI_TOKEN"],
file: source
)
notify_about_new_build(
source,
lane_context[SharedValues::UPLOADED_FILE_LINK_TO_DIAWI]
)
end
platform :ios do
desc "`fastlane ios adhoc` - ad-hoc lane for iOS."
desc "This lane is used PRs, Releases, etc."
desc "It creates an .ipa that can be used by a list of devices, registeded in the App Store Connect."
desc "This .ipa is ready to be distibuted through diawi.com"
lane :adhoc do
unlock_keychain_if_needed
build_ios_adhoc
end
desc "`fastlane ios nightly` - makes a new nightly in TestFlight"
desc "This lane builds a new nightly and uploads it to TestFlight"
desc "It also leaves an .ipa that is ad-hoc signed (can be uploaded to diawi)"
lane :nightly do
unlock_keychain_if_needed
match(
type: "appstore",
force_for_new_devices: true,
readonly: true,
keychain_name: "login.keychain"
)
build_ios_app(
scheme: "StatusIm",
workspace: "ios/StatusIm.xcworkspace",
configuration: "Release",
clean: true,
export_method: "app-store",
output_directory: "status_appstore"
)
upload_to_testflight(
ipa: "status_appstore/StatusIm.ipa"
)
slack(
message: "New nightly build uploaded to TestFlight",
slack_url: ENV["SLACK_URL"]
)
# additional .ipa is for diawi
# we have to re-build it because it uses different config
build_ios_adhoc
end
desc "`fastlane ios release` builds a release & uploads it to TestFlight"
2018-04-04 16:36:26 +00:00
lane :release do
match(
type: "appstore",
force_for_new_devices: true,
readonly: true,
keychain_name: "login.keychain"
)
build_ios_app(
scheme: "StatusIm",
workspace: "ios/StatusIm.xcworkspace",
configuration: "Release",
clean: true,
export_method: "app-store",
output_directory: "status_appstore",
export_options: {
"combileBitcode": true,
"uploadBitcode": false,
"ITSAppUsesNonExemptEncryption": false
}
)
2018-04-04 16:36:26 +00:00
upload_to_testflight(
ipa: "status_appstore/StatusIm.ipa"
)
slack(
message: "New release build uploaded to TestFlight",
slack_url: ENV["SLACK_URL"]
2018-04-04 16:36:26 +00:00
)
end
desc "`fastlane ios clean` - remove inactive TestFlight users"
desc "uses custom plugin, installed via"
desc "`sudo get install fastlane-plugin-clean_testflight_testers`"
lane :clean do
clean_testflight_testers
end
desc "`fastlane ios upload-diawi` - upload .ipa to diawi"
desc "also notifies in a GitHub comments and in Slack #jenkins channel"
desc "expects to have an .ipa prepared: `status-adhoc/StatusIm.ipa`"
desc "expects to have a diawi token as DIAWI_TOKEN env variable"
desc "expects to have a github token as GITHUB_TOKEN env variable"
desc "expects to have a slack webhook URL as SLACK_URL env variable"
desc "will fails if file isn't there"
lane :upload_diawi do
upload_to_diawi_and_notify(
"status-adhoc/StatusIm.ipa"
)
end
end
platform :android do
desc "Deploy a new internal build to Google Play"
desc "expects GOOGLE_PLAY_JSON_KEY environment variable"
lane :nightly do
upload_to_play_store(
track: "internal",
apk: "android/app/build/outputs/apk/release/app-release.apk",
json_key_data: ENV["GOOGLE_PLAY_JSON_KEY"]
)
slack(
message: "New nightly build uploaded to Google Play",
slack_url: ENV["SLACK_URL"]
)
end
2018-04-04 16:36:26 +00:00
lane :release do
desc "Deploy a new alpha (public) build to Google Play"
desc "expects GOOGLE_PLAY_JSON_KEY environment variable"
2018-04-04 16:36:26 +00:00
upload_to_play_store(
track: "alpha",
apk: "android/app/build/outputs/apk/release/app-release.apk",
json_key_data: ENV["GOOGLE_PLAY_JSON_KEY"]
)
slack(
message: "New release build uploaded to Google Play",
slack_url: ENV["SLACK_URL"]
2018-04-04 16:36:26 +00:00
)
end
desc "`fastlane android upload-diawi` - upload .ipa to diawi"
desc "also notifies in a GitHub comments and in Slack #jenkins channel"
desc "expects to have an .apk prepared: `android/app/build/outputs/apk/release/app-release.apk`"
desc "expects to have a diawi token as DIAWI_TOKEN env variable"
desc "expects to have a github token as GITHUB_TOKEN env variable"
desc "expects to have a slack webhook URL as SLACK_URL env variable"
desc "will fails if file isn't there"
lane :upload_diawi do
upload_to_diawi_and_notify(
"android/app/build/outputs/apk/release/app-release.apk"
)
end
end