How we use fastlene for android at ookami, Inc.
We use fastlane to
1. Build using gradle
2. Beta Distribution
3. Upload builds and metadata to Google Play
See more about fastlane.
https://github.com/fastlane/fastlane
Supply - Command line tool for updating Android apps and their metadata on the Google Play Store.
https://github.com/fastlane/supply
13. Beta Distribution
13
fastlane / Fastfile
Build
Distribution
Import
lane :beta do
# Build
gradle(task: “assembleStaging”)
# Push to Crashlytics
crashlytics(
groups: “developer”,
notifications: false
)
# Post to Slack
slack(
message: “Successfully deployed new App Update.”
)
end
14. Beta Distribution
14
fastlane / Fastfile
Build
Distribution
Import
lane :beta do
# Build
gradle(task: “assembleStaging”)
# Push to Crashlytics
crashlytics(
groups: “developer”,
notifications: false
)
# Post to Slack
slack(
message: “Successfully deployed new App Update.”
)
end
15. Beta Distribution
15
fastlane / Fastfile
Build
Distribution
Import
lane :beta do
# Build
gradle(task: “assembleStaging”)
# Push to Crashlytics
crashlytics(
groups: “developer”,
notifications: false
)
# Post to Slack
slack(
message: “Successfully deployed new App Update.”
)
end
16. Beta Distribution
16
fastlane / Fastfile
Build
Distribution
Import
lane :beta do
# Build
gradle(task: “assembleStaging”)
# Push to Crashlytics
crashlytics(
groups: “developer”,
notifications: false
)
# Post to Slack
slack(
message: “Successfully deployed new App Update.”
)
end
17. Beta Distribution
17
fastlane / Fastfile
Build
Distribution
Import
lane :beta do
# Build
gradle(task: “assembleStaging”)
# Push to Crashlytics
crashlytics(
groups: “developer”,
notifications: false
)
# Post to Slack
slack(
message: “Successfully deployed new App Update.”
)
end
Action
Action
Action
23. fastlane
• Use fastlane to
1. Build using gradle
2. Beta Distribution
3. Upload builds and metadata to Google Play
23
24. Release Distribution
24
fastlane / Fastfile
Build
Distribution
Import
lane :deploy do
# Generate key files
dir = “./fastlane/certs”
add_key(
keystore_path: File.join(dir, “release.keystore”),
play_p12_path: File.join(dir, “play.p12”)
)
# Build
gradle(task: “assembleRelease”)
# Upload to Google Play
supply(
track: “alpha”
)
# Delete key files
remove_key
end
25. Release Distribution
25
fastlane / Fastfile
Build
Distribution
Import
lane :deploy do
# Generate key files
dir = “./fastlane/certs”
add_key(
keystore_path: File.join(dir, “release.keystore”),
play_p12_path: File.join(dir, “play.p12”)
)
# Build
gradle(task: “assembleRelease”)
# Upload to Google Play
supply(
track: “alpha”
)
# Delete key files
remove_key
end
26. Release Distribution
26
fastlane / Fastfile
Build
Distribution
Import
lane :deploy do
# Generate key files
dir = “./fastlane/certs”
add_key(
keystore_path: File.join(dir, “release.keystore”),
play_p12_path: File.join(dir, “play.p12”)
)
# Build
gradle(task: “assembleRelease”)
# Upload to Google Play
supply(
track: “alpha”
)
# Delete key files
remove_key
end
27. Release Distribution
27
fastlane / Fastfile
Build
Distribution
Import
lane :deploy do
# Generate key files
dir = “./fastlane/certs”
add_key(
keystore_path: File.join(dir, “release.keystore”),
play_p12_path: File.join(dir, “play.p12”)
)
# Build
gradle(task: “assembleRelease”)
# Upload to Google Play
supply(
track: “alpha”
)
# Delete key files
remove_key
end
28. Release Distribution
28
fastlane / Appfile
# Follow https://github.com/fastlane/supply#setup to get one
issuer “fastlane@api-123456789-12345.iam.gserviceaccount.com”
# Path to the keyfile
keyfile “./fastlane/certs/play.p12"
# e.g. com.krausefx.app
package_name “your.package.name”
• Setup for connecting to Google Play
29. Release Distribution
29
fastlane / Fastfile
Build
Distribution
Import
lane :deploy do
# Generate key files
dir = “./fastlane/certs”
add_key(
keystore_path: File.join(dir, “release.keystore”),
play_p12_path: File.join(dir, “play.p12”)
)
# Build
gradle(task: “assembleRelease”)
# Upload to Google Play
supply(
track: “alpha”
)
# Delete key files
remove_key
end
30. Release Distribution
30
fastlane / Fastfile
Build
Distribution
Import
lane :deploy do
# Generate key files
dir = “./fastlane/certs”
add_key(
keystore_path: File.join(dir, “release.keystore”),
play_p12_path: File.join(dir, “play.p12”)
)
# Build
gradle(task: “assembleRelease”)
# Upload to Google Play
supply(
track: “alpha”
)
# Delete key files
remove_key
end
Custom Action
Custom Action
31. Release Distribution
31
fastlane / Fastfile - Custom Action
module Fastlane
module Actions
class AddKeyAction < Action
def self.run(params)
keystore_path = params[:keystore_path]
play_p12_path = params[:play_p12_path]
encryption_secret = ENV["ENCRYPTION_SECRET"]
sh "openssl aes-256-cbc -k #{encryption_secret} -in #{keystore_path}.enc -d -a -out #{keystore_path}"
sh "openssl aes-256-cbc -k #{encryption_secret} -in #{play_p12_path}.enc -d -a -out #{play_p12_path}"
end
end
end
end
module Fastlane
module Actions
class RemoveKeyAction < Action
def self.run(params)
sh "rm -rf fastlane/certs"
end
end
end
end