mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-21 12:25:57 +03:00
Setup fastlane to build app, release on Google Play and create git tag
Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
bed7449f1d
commit
a02624d7e2
3 changed files with 102 additions and 15 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -8,3 +8,4 @@
|
||||||
/projectFilesBackup/
|
/projectFilesBackup/
|
||||||
# fastlane
|
# fastlane
|
||||||
/vendor/bundle
|
/vendor/bundle
|
||||||
|
fastlane/report.xml
|
||||||
|
|
|
@ -13,23 +13,109 @@
|
||||||
# Uncomment the line if you want fastlane to automatically update itself
|
# Uncomment the line if you want fastlane to automatically update itself
|
||||||
# update_fastlane
|
# update_fastlane
|
||||||
|
|
||||||
|
## 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=""
|
||||||
|
|
||||||
|
|
||||||
skip_docs
|
skip_docs
|
||||||
|
|
||||||
default_platform(:android)
|
default_platform(:android)
|
||||||
|
|
||||||
|
BUNDLE_PATH = "app/build/outputs/bundle/playRelease/app-play-release.aab"
|
||||||
|
|
||||||
platform :android do
|
platform :android do
|
||||||
desc "Submit a new Beta Build to Crashlytics Beta"
|
desc "Build app bundle"
|
||||||
lane :beta do
|
|
||||||
gradle(task: "clean assembleRelease")
|
|
||||||
crashlytics
|
|
||||||
|
|
||||||
# sh "your_script.sh"
|
lane :releasePhase1 do
|
||||||
# You can also use other beta testing services here
|
test()
|
||||||
end
|
buildBundle()
|
||||||
|
end
|
||||||
|
|
||||||
|
lane :test do
|
||||||
|
gradle(task: "clean testPlayReleaseUnitTest testFdroidReleaseUnitTest")
|
||||||
|
end
|
||||||
|
|
||||||
|
lane :buildBundle do
|
||||||
|
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
|
||||||
|
|
||||||
|
lane :releasePhase2 do
|
||||||
|
versionInfo = getVersionInfo()
|
||||||
|
promptVersion(versionInfo)
|
||||||
|
checkArtifactsExist()
|
||||||
|
tag(versionInfo)
|
||||||
|
uploadToPlayStore()
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Read versions from gradle file"
|
||||||
|
private_lane :getVersionInfo do
|
||||||
|
File.open("../app/build.gradle","r") do |file|
|
||||||
|
text = file.read
|
||||||
|
versionName = text.match(/versionName "([0-9\.]*)"$/)[1]
|
||||||
|
versionCode = text.match(/versionCode ([0-9]*)$/)[1]
|
||||||
|
|
||||||
|
{ "versionCode" => versionCode, "versionName" => versionName }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Show versions and prompt for confirmation"
|
||||||
|
private_lane :promptVersion do |versionInfo|
|
||||||
|
currentBranch = git_branch()
|
||||||
|
print "Version code: #{versionInfo["versionCode"]}\n"
|
||||||
|
print "Version name: #{versionInfo["versionName"]}\n"
|
||||||
|
print "Current branch: #{currentBranch}\n"
|
||||||
|
print "Tag (to be created): #{versionInfo["versionName"]}\n"
|
||||||
|
|
||||||
|
|
||||||
|
answer = prompt(text: "is this okay?", boolean: true)
|
||||||
|
|
||||||
|
if !answer
|
||||||
|
exit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Check if release artifacts exist"
|
||||||
|
private_lane :checkArtifactsExist do
|
||||||
|
if !File.exist?("../#{BUNDLE_PATH}")
|
||||||
|
print "Bundle not found at #{BUNDLE_PATH}\n"
|
||||||
|
exit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
desc "Create release tag"
|
||||||
|
private_lane :tag do |versionInfo|
|
||||||
|
tagName = versionInfo["versionName"]
|
||||||
|
add_git_tag(
|
||||||
|
tag: tagName,
|
||||||
|
sign: true
|
||||||
|
)
|
||||||
|
push_git_tags(tag: tagName)
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Upload release artifacts to Google Play"
|
||||||
|
private_lane :uploadToPlayStore do
|
||||||
|
upload_to_play_store(
|
||||||
|
skip_upload_images: true,
|
||||||
|
skip_upload_apk: true,
|
||||||
|
aab: BUNDLE_PATH,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
desc "Deploy a new version to the Google Play"
|
|
||||||
lane :deploy do
|
|
||||||
gradle(task: "clean assembleRelease")
|
|
||||||
upload_to_play_store
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue