Skip to content

Instantly share code, notes, and snippets.

View shafayathossain's full-sized avatar

Shafayat Hossain shafayathossain

  • Dhaka, Bangladesh
View GitHub Profile
@shafayathossain
shafayathossain / Fastfile distribute_playstore.rb
Created December 1, 2021 17:09
Responsible for uploading aab to playstore
desc "Responsible for uploading aab to playstore"
lane :distribute_playstore do
upload_to_play_store(
track: "production",
aab: BUNDLE_FILE_PATH,
json_key: PLAYSTORE_KEY_PATH,
package_name: PACKAGE_NAME
)
end
@shafayathossain
shafayathossain / Fastfile distribute_to_firebase.rb
Created December 1, 2021 17:08
Responsible for uploading .aab to Firebase app distribution.
desc "Responsible for uploading .aab to Firebase app distribution."
lane :distribute_to_firebase do
firebase_app_distribution(
app: FIREBASE_APP_ID,
release_notes: "Uploaded from CI/CD",
android_artifact_type: "AAB",
android_artifact_path: BUNDLE_FILE_PATH,
service_credentials_file: FIREBASE_KEY_PATH,
groups: "tester-team"
)
@shafayathossain
shafayathossain / Fastfile build.rb
Created December 1, 2021 17:06
Build the .aab file
desc "Build the .aab file"
lane :build do
gradle(
task: "bundle",
build_type: "Release",
properties: {
"android.injected.signing.store.file" => KEYSTORE_PATH,
"android.injected.signing.store.password" => ENV['KEYSTORE_PASSWORD'],
"android.injected.signing.key.alias" => ENV['KEYSTORE_ALIAS'],
"android.injected.signing.key.password" => ENV['KEYSTORE_PASSWORD']
desc "Run unit tests."
lane :run_unit_tests do
gradle(
task: "test"
)
end
@shafayathossain
shafayathossain / Fastfile increment_version_code_in_project_gradle.rb
Created December 1, 2021 17:01
Responsible for fetching version code from play console and incrementing version code.
desc "Responsible for fetching version code from play console and incrementing version code."
lane :increment_version_code_in_project_gradle do
version_code_from_play_store_strings = google_play_track_version_codes(
package_name: PACKAGE_NAME, # PACKAGE_NAME is a global variable defined earlier
track: "production", # this can be alpha, beta etc.
json_key: PLAYSTORE_KEY_PATH,
)
version_code_from_play_store = version_code_from_play_store_strings[0].to_i
UPDATED_VERSION_CODE = version_code_from_play_store + 1
increment_version_code(
@shafayathossain
shafayathossain / fastfile before_all.rb
Last active December 1, 2021 17:02
`before_all` block of fastfile
fastlane_require "dotenv"
PACKAGE_NAME = "<package name here>"
FIREBASE_APP_ID = "<firebase app id here>"
KEYSTORE_PATH = nil
FIREBASE_KEY_PATH = nil
PLAYSTORE_KEY_PATH = nil
BUNDLE_FILE_PATH = nil
UPDATED_VERSION_CODE = nil
before_all do
Dotenv.overload ".env.secret"