2023-02-02 17:29:06 +03:00
|
|
|
# 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
|
|
|
|
|
2023-02-02 18:26:23 +03:00
|
|
|
## config
|
|
|
|
# add following to your shell rc:
|
|
|
|
# export FASTLANE_NOTES_UPLOAD_STORE_FILE=""
|
|
|
|
# export FASTLANE_NOTES_UPLOAD_STORE_PASSWORD=""
|
|
|
|
# export FASTLANE_NOTES_UPLOAD_KEY_ALIAS=""
|
|
|
|
# export FASTLANE_NOTES_UPLOAD_KEY_PASSWORD=""
|
|
|
|
# export FASTLANE_NEXTCLOUD_GITHUB_API_TOKEN=""
|
|
|
|
|
|
|
|
|
2023-02-02 17:32:45 +03:00
|
|
|
skip_docs
|
|
|
|
|
2023-02-02 17:29:06 +03:00
|
|
|
default_platform(:android)
|
|
|
|
|
2023-02-02 18:26:23 +03:00
|
|
|
BUNDLE_PATH = "app/build/outputs/bundle/playRelease/app-play-release.aab"
|
|
|
|
|
2023-02-03 13:54:43 +03:00
|
|
|
import("./common.Fastfile")
|
2023-02-03 12:47:45 +03:00
|
|
|
|
2023-02-02 17:29:06 +03:00
|
|
|
platform :android do
|
2023-02-02 18:26:23 +03:00
|
|
|
desc "Build app bundle"
|
|
|
|
|
2023-02-03 13:54:43 +03:00
|
|
|
desc "Run tests and build app"
|
2023-02-02 18:26:23 +03:00
|
|
|
lane :releasePhase1 do
|
|
|
|
test()
|
|
|
|
buildBundle()
|
|
|
|
end
|
|
|
|
|
2023-02-03 13:54:43 +03:00
|
|
|
desc "Release previously built app to Google Play and create tag"
|
|
|
|
lane :releasePhase2 do
|
|
|
|
versionInfo = getVersionInfo()
|
|
|
|
versionComponents = parseVersionCode(versionInfo)
|
|
|
|
checkReleasable(versionComponents)
|
|
|
|
storeTrack = getPlayStoreTrack(versionComponents)
|
|
|
|
tagName = getTagName(versionComponents)
|
|
|
|
preReleaseChecks(versionInfo: versionInfo, tagName: tagName, type: versionComponents["type"], track: storeTrack)
|
|
|
|
checkArtifactsExist()
|
2023-03-08 14:27:09 +03:00
|
|
|
tag(name: tagName)
|
|
|
|
uploadToPlayStore(track: storeTrack)
|
2023-02-03 13:54:43 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Run tests"
|
2023-02-02 18:26:23 +03:00
|
|
|
lane :test do
|
|
|
|
gradle(task: "clean testPlayReleaseUnitTest testFdroidReleaseUnitTest")
|
|
|
|
end
|
|
|
|
|
2023-02-03 13:54:43 +03:00
|
|
|
desc "Build app bundle"
|
|
|
|
lane :buildBundle do
|
2023-02-02 18:26:23 +03:00
|
|
|
gradle(
|
|
|
|
task: 'bundle',
|
|
|
|
flavor: 'play',
|
|
|
|
build_type: 'Release',
|
|
|
|
print_command: false,
|
|
|
|
properties: {
|
|
|
|
"android.injected.signing.store.file" => ENV["FASTLANE_NOTES_UPLOAD_STORE_FILE"],
|
|
|
|
"android.injected.signing.store.password" => ENV["FASTLANE_NOTES_UPLOAD_STORE_PASSWORD"],
|
|
|
|
"android.injected.signing.key.alias" => ENV["FASTLANE_NOTES_UPLOAD_KEY_ALIAS"],
|
|
|
|
"android.injected.signing.key.password" => ENV["FASTLANE_NOTES_UPLOAD_KEY_PASSWORD"],
|
|
|
|
}
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Show versions and prompt for confirmation"
|
2023-02-03 13:54:43 +03:00
|
|
|
private_lane :preReleaseChecks do |options|
|
|
|
|
versionInfo = options[:versionInfo]
|
|
|
|
tagName = options[:tagName]
|
2023-02-02 18:26:23 +03:00
|
|
|
currentBranch = git_branch()
|
2023-02-03 13:54:43 +03:00
|
|
|
text = "Version code: #{versionInfo["versionCode"]}\n" +
|
|
|
|
"Version name: #{versionInfo["versionName"]}\n" +
|
|
|
|
"Current branch: #{currentBranch}\n" +
|
|
|
|
"Version type: #{options[:type]}\n" +
|
|
|
|
"Tag: #{tagName}\n" +
|
|
|
|
"Track: #{options[:track]}"
|
|
|
|
promptYesNo(text: text)
|
2023-02-02 18:26:23 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Check if release artifacts exist"
|
|
|
|
private_lane :checkArtifactsExist do
|
|
|
|
if !File.exist?("../#{BUNDLE_PATH}")
|
2023-02-03 13:54:43 +03:00
|
|
|
UI.user_error!("Bundle not found at #{BUNDLE_PATH}")
|
2023-02-02 18:26:23 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
desc "Create release tag"
|
2023-03-08 14:27:09 +03:00
|
|
|
private_lane :tag do |options|
|
|
|
|
tagName = options[:name]
|
2023-02-02 18:26:23 +03:00
|
|
|
add_git_tag(
|
|
|
|
tag: tagName,
|
|
|
|
sign: true
|
|
|
|
)
|
|
|
|
push_git_tags(tag: tagName)
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Upload release artifacts to Google Play"
|
2023-02-03 13:54:43 +03:00
|
|
|
private_lane :uploadToPlayStore do |options|
|
2023-02-02 18:26:23 +03:00
|
|
|
upload_to_play_store(
|
|
|
|
skip_upload_images: true,
|
|
|
|
skip_upload_apk: true,
|
2023-02-03 13:54:43 +03:00
|
|
|
track: options[:track],
|
|
|
|
aab: BUNDLE_PATH
|
2023-02-02 18:26:23 +03:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2023-02-02 17:29:06 +03:00
|
|
|
end
|