Files
sailing-analytics/fastlane/Fastfile
T

81 lines
1.9 KiB
Ruby

# 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
#
default_platform(:android)
platform :android do
def update_version_code(code: 1)
set_properties_value(
path: "gradle.properties",
key: "versionCode",
value: "#{code}"
)
end
desc "Compile debug and test sources and lint them"
lane :build do
gradle(task: "compileDebugSources")
gradle(task: "compileDebugUnitTestSources")
gradle(task: "compileDebugAndroidTestSources")
end
desc "Runs all the tests & creates Jacoco Coverage reports"
lane :test do
UI.message("Using empty test reports")
# gradle(task: "jacocoTestCoverageVerification")
end
desc "Assemble app"
lane :releaseBuild do
# Automatic versioning
if is_ci
commits = sh("git rev-list --count HEAD").to_i
update_version_code(code: commits)
# Generate GroupId, ArtifactId, Version coordinates for central signing service
generate_gav
end
gradle(task: "assembleRelease") # Build .apk
gradle(task: "bundleRelease") # Build .aab
end
desc "Call Kotlin Lint"
lane :lint do
gradle(task: "ktlintCheck")
end
desc "Print GAV for central signing service to gav.json"
private_lane :generate_gav do
versionName = get_properties_value(
key: "versionName",
path: "gradle.properties"
)
versionCode = get_properties_value(
key: "versionCode",
path: "gradle.properties"
)
gav = {
groupID: CredentialsManager::AppfileConfig.try_fetch_value(:package_name),
artifactID: 'sapsailing',
version: "#{versionName}.#{versionCode}"
}
write_json(
file_path: "gav.json",
hash: gav
)
end
end