Commit 8650c5f0 authored by Thomas Markiewicz's avatar Thomas Markiewicz
Browse files

Updated CI and Fastlane for gitlab workflow with master branch only

parent 45b8f663
Pipeline #51388 failed with stages
in 47 seconds
stages:
- build_only
- playstore
- test
- build
- deploy
variables:
LANG: "en_US.UTF-8"
LC_ALL: "en_US.UTF-8"
before_script:
- bundle update
playstore:
test:
stage: test
tags:
- android
stage: playstore
script:
- bundle exec fastlane playstore
only:
- /^release\/.*$/
environment:
name: playstore
- ./gradlew clean test
artifacts:
name: "one_playstore_$MAJOR.$MINOR.$PATCH-$CI_COMMIT_REF_NAME+$CI_PIPELINE_IID.apk"
paths:
- ./*.apk
expire_in: 4 weeks
- coverage/
only:
- master
- merge_requests
build_only:
build:
stage: build
tags:
- android
stage: build_only
dependencies:
- test
script:
- bundle install
- bundle exec fastlane build
only:
- develop
- master
- /^feature\/.*$/
- /^issue\/.*$/
environment:
name: playstore
artifacts:
name: "one_playstore_$MAJOR.$MINOR.$PATCH-$CI_COMMIT_REF_NAME+$CI_PIPELINE_IID.apk"
paths:
- ./*.apk
expire_in: 4 weeks
- merge_requests
deploy:
stage: deploy
tags:
- android
script:
- bundle install
- bundle exec fastlane deploy
only:
- /^(\d+\.)?(\d+\.)?(\*|\d+)$/
except:
- branches
\ No newline at end of file
json_key_file("/Users/gitlabrunner/Nextcloud/LibertyApps/PlayStore/secrets/api-6019011998585182423-754965-83a427df00b1.json") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one
package_name("one.librem.one") # e.g. com.krausefx.app
json_key_file("~/api-6019011998585182423-754965-83a427df00b1.json")
package_name("one.librem.one")
......@@ -4,11 +4,11 @@ default_platform(:android)
platform :android do
before_all do
ENV["RIOT_URL"] = "" # Webhool URL created in Riot
update_fastlane
end
desc "Build and deploy a new version for PlayStore"
lane :playstore do
lane :deploy do
gradle(task: "clean")
......@@ -17,43 +17,15 @@ platform :android do
build_type: "Release",
print_command: true
)
file_path = lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]
file_name = file_path.gsub(/\/.*\//,"")
branch_name = ENV["CI_COMMIT_REF_NAME"].gsub("/","_")
target_filename = "one_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
upload_to_play_store(
track: "internal"
)
end
desc "Build and deploy a new version to F-Droid"
lane :fdroid do
gradle(
task: "assemble",
build_type: "Release",
flavor: "appfdroid"
track: "beta"
)
upload_to_play_store
end
after_all do |lane|
# This block is called only if the executed lane was successfull
end
error do |lane, exception|
if is_ci
# send a message to Riot room that includes exception.message
end
end
desc "Sanity build without beta deployment"
desc "Sanity build without upload"
lane :build do
gradle(task: "clean")
......@@ -63,14 +35,6 @@ platform :android do
build_type: "Release",
print_command: true
)
file_path = lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]
file_name = file_path.gsub(/\/.*\//,"")
branch_name = ENV["CI_COMMIT_REF_NAME"].gsub("/","_")
target_filename = "one_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
......
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