Commit 5abc3cc0 authored by Thomas Markiewicz's avatar Thomas Markiewicz

Added another CI/CD stage that uploads to Playstore only on release branches

parent 73fbe283
Pipeline #5049 passed with stage
in 3 minutes and 43 seconds
stages:
- build_only
- playstore
variables:
......@@ -14,9 +15,27 @@ playstore:
stage: playstore
script:
- bundle exec fastlane playstore
only:
- /^release\/.*$/
environment:
name: playstore
artifacts:
name: "mail_playstore_$MAJOR.$MINOR.$PATCH-$CI_COMMIT_REF_NAME+$CI_PIPELINE_IID.apk"
paths:
- ./*.apk
expire_in: 4 weeks
build_only:
tags:
- android
stage: build_only
script:
- bundle exec fastlane build
only:
- develop
- master
- /^feature\/.*$/
- /^issue\/.*$/
environment:
name: playstore
artifacts:
......
......@@ -18,7 +18,8 @@ platform :android do
# Rename and copy the apk to root folder
file_path = lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]
file_name = file_path.gsub(/\/.*\//,"")
target_filename = "mail_playstore_" + ENV["MAJOR"] + "." + ENV["MINOR"] + "." + ENV["PATCH"] + "-" + ENV["CI_COMMIT_REF_NAME"] + "+" + ENV["CI_PIPELINE_IID"] + ".apk"
branch_name = ENV["CI_COMMIT_REF_NAME"].gsub("/","_")
target_filename = "mail_playstore_" + ENV["MAJOR"] + "." + ENV["MINOR"] + "." + ENV["PATCH"] + "-" + branch_name + "+" + ENV["CI_PIPELINE_IID"] + ".apk"
target_path = "../" + target_filename
sh "echo Copying " + file_name + " to: " + target_path
sh "cp " + file_path + " " + target_path
......@@ -39,6 +40,31 @@ platform :android do
upload_to_play_store
end
desc "Sanity build only without uploading"
lane :build do
gradle(task: "clean")
gradle(
task: "assemble",
build_type: "Release",
flavor: "libremmail",
print_command: true
)
# Rename and copy the apk to root folder
file_path = lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]
file_name = file_path.gsub(/\/.*\//,"")
branch_name = ENV["CI_COMMIT_REF_NAME"].gsub("/","_")
target_filename = "mail_playstore_" + ENV["MAJOR"] + "." + ENV["MINOR"] + "." + ENV["PATCH"] + "-" + branch_name + "+" + ENV["CI_PIPELINE_IID"] + ".apk"
target_path = "../" + target_filename
sh "echo Copying " + file_name + " to: " + target_path
sh "cp " + file_path + " " + target_path
end
after_all do |lane|
# This block is called only if the executed lane was successfull
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment