Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@underwindfall
Created October 10, 2018 09:47
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 underwindfall/177e592533b1cd7cad029abc0e3a85c5 to your computer and use it in GitHub Desktop.
Save underwindfall/177e592533b1cd7cad029abc0e3a85c5 to your computer and use it in GitHub Desktop.
FastFile Template
# 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
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
fastlane_require 'nokogiri'
default_platform(:android)
platform :android do
before_all do
load_keys
end
def load_keys
begin
import("../../../jenkins_res/fastlane/keys")
ENV["FASTLANE_PASSWORD"]=ENV["PASSWORD"]
rescue => exception
import("../../keys")
UI.error("Not on CI server, load local config")
end
end
desc "Increment app version"
lane :increment_version do |options|
path = '../app/build.gradle'
re = /versionName\s+"([a-zA-Z\d\.-]+)"/
s = File.read(path)
s[re, 1] = options[:version]
f = File.new(path, 'w')
f.write(s)
f.close
end
desc "Update Android Strings file"
lane :update_deepLink do |options|
path = "../app/src/#{options[:flavor]}/res/values/strings.xml"
doc = Nokogiri::XML(File.open(path))
link_node = doc.at("/resources/string[@name='app_domain']")
link_node.content = options[:url]
File.write(path, doc.to_xml)
end
desc "Submit a new Beta Build to Crashlytics Beta"
lane :beta do |options|
apk = options[:apk_path] || "app/build/outputs/apk/#{options[:flavor]}/release/app-#{options[:flavor]}-release.apk"
flavor = options[:flavor].slice(0,1).capitalize + options[:flavor].slice(1..-1)
gradle(task: "assemble#{flavor}Release")
crashlytics(
api_token: ENV["CRASHLYTICS_API_TOKEN"],
build_secret: ENV["CRASHLYTICS_BUILD_SECRET"],
apk_path: apk,
groups: options[:beta_group] || "mptesters",
notifications: true,
notes_path: ENV["RELEASE_NOTES_PATH"]
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment