Skip to content

Instantly share code, notes, and snippets.

@andreferi3
Last active August 27, 2020 09:33
Show Gist options
  • Select an option

  • Save andreferi3/b49c70e95d81826ca8f7e59c9b0257af to your computer and use it in GitHub Desktop.

Select an option

Save andreferi3/b49c70e95d81826ca8f7e59c9b0257af to your computer and use it in GitHub Desktop.
fastlane_version "2.154.0"
before_all do |lane, options|
ensure_git_branch(branch: 'YOUR_BRANCH')
ensure_git_status_clean
git_pull
end
platform :android do
desc "Get list of version on build gradle"
lane :show_all_version do
version = get_version_name(app_project_dir: '**/app')
UI.message("Default: " + version)
version_code = get_version_code(app_project_dir: '**/app')
UI.message("Default: " + version_code)
version_beta = get_version_name(
app_project_dir: '**/app',
flavor: 'beta'
)
UI.message("beta flavor: " + version_beta)
version_code_beta = get_version_code(
app_project_dir: '**/app',
flavor: 'beta'
)
UI.message("beta flavor: " + version_code_beta)
end
desc "Bump up version based on semver rules"
lane :bumpup_beta do
type_bump = UI.select("Select version change: ", ["major", "minor", "patch"])
increment_version_name(
app_project_dir: '**/app',
bump_type: type_bump,
)
increment_version_code(app_project_dir: '**/app')
increment_version_name(
app_project_dir: '**/app',
bump_type: type_bump,
flavor: 'beta'
)
increment_version_code(app_project_dir: '**/app', flavor: "beta")
show_all_version
end
desc "Upload codepush beta"
lane :codepush_beta do |options|
current_version = get_version_name(app_project_dir: '**/app', flavor: 'beta')
Dir.chdir("..") do
sh "appcenter codepush release-react -a YOUR_APPNAME -d DEVELOPMENT_TYPE" do |status, result, command|
unless status.success?
UI.error "Command #{command} failed with status #{status.exitstatus}"
end
UI.success "๐Ÿš€ All done! Check out the rollout & install stats in the Codepush section of the dashboard on App Center."
end
end
end
desc "Upload codepush production"
lane :codepush_prod do |options|
current_version = get_version_name(app_project_dir: '**/app', flavor: 'beta')
Dir.chdir("..") do
sh "appcenter codepush release-react -a YOUR_APPNAME -d DEVELOPMENT_TYPE" do |status, result, command|
unless status.success?
UI.error "Command #{command} failed with status #{status.exitstatus}"
end
UI.success "๐Ÿš€ All done! Check out the rollout & install stats in the Codepush section of the dashboard on App Center."
end
end
end
desc "Build android beta release app"
lane :build do |options|
bumpup_beta
gradle(task: 'clean', project_dir: './android')
gradle(task: 'assemble', build_type: 'Release', project_dir: './android')
end
desc "Distribute to firebase app distribution"
lane :firebase_beta do |options|
firebase_app_distribution(
app: 'APP_ID_IN_FIREBASE',
groups: 'afterwords-tester',
release_notes: 'Lots of new features to test out!'
)
end
desc "Release app to firebase distribution"
lane :release_beta do |options|
build
firebase_beta
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment