Skip to content

Instantly share code, notes, and snippets.

@matsuokah
Created December 3, 2016 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matsuokah/6c40c228a8d13a279a0b35c9213736f4 to your computer and use it in GitHub Desktop.
Save matsuokah/6c40c228a8d13a279a0b35c9213736f4 to your computer and use it in GitHub Desktop.
fastlane_version "1.109.0"
load './Context'
default_platform :android
platform :android do
before_all do
ENV['SLACK_URL'] = Slack.url
ENV['FL_SLACK_CHANNEL'] = Slack.channel
ENV['FL_SLACK_USERNAME'] = Slack.username
ENV["CRASHLYTICS_API_TOKEN"] = Fabric.api_token
ENV["CRASHLYTICS_BUILD_SECRET"] = Fabric.build_secret
end
desc "Runs all the tests"
lane :test do
gradle(task: "test")
end
lane :prd do |options|
options[:env] = 'prd'
beta(options)
end
lane :stg do |options|
options[:env] = 'stg'
beta(options)
end
lane :dev do |options|
options[:env] = 'dev'
beta(options)
end
private_lane :beta do |options|
archive(options)
crashlytics(groups: Fabric.tester_group)
end
private_lane :archive do |options|
env = options.fetch(:env, 'dev')
build_type = options.fetch(:type, 'Release')
begin
BuildContext.validate_env(env)
rescue => e
UI.user_error!(e.message)
Kernel.abort
end
context = BuildContext.new(env, build_type)
gradle(
task: context.task,
flavor: context.flavor,
build_type: context.build_type,
flags: "-PdisablePreDex"
)
copy_artifacts(
target_path: "artifacts",
artifacts: [context.apk_path]
)
end
after_all do |lane|
slack(
message: 'Application was build',
)
end
error do |lane, exception|
slack(
success: false,
message: exception.message
)
end
end
# vim: ft=ruby sw=2 ts=2 sts=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment