From ad0b1f02f6bb9db275287c5de4b2a722564df97d Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 17 Jun 2021 18:29:41 +0200 Subject: [PATCH] Add the script to upload metadata to GooglePlay fix script --- fastlane/Fastfile | 18 ++++- fastlane/README.md | 49 +++++++++++ tools/release/pushPlayStoreMetaData.sh | 108 +++++++++++++++++++++++++ 3 files changed, 174 insertions(+), 1 deletion(-) create mode 100644 fastlane/README.md create mode 100755 tools/release/pushPlayStoreMetaData.sh diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 4c76f01bee..f288326306 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -38,6 +38,22 @@ platform :android do desc "Deploy Google Play metadata" lane :deployMeta do - upload_to_play_store skip_upload_apk:true skip_upload_images:true skip_upload_screenshots:true validate_only:true + # Doc: https://docs.fastlane.tools/actions/upload_to_play_store/ + upload_to_play_store( + skip_upload_apk: true, + skip_upload_aab: true, + skip_upload_images: true, + skip_upload_screenshots: true, + skip_upload_changelogs: true, + validate_only: true + ) + end + + desc "Get version code" + lane :getVersionCode do + versions = google_play_track_version_codes(track: "production") + puts(versions) + version_code = versions[0] + puts(version_code) end end diff --git a/fastlane/README.md b/fastlane/README.md new file mode 100644 index 0000000000..54d3a005a6 --- /dev/null +++ b/fastlane/README.md @@ -0,0 +1,49 @@ +fastlane documentation +================ +# Installation + +Make sure you have the latest version of the Xcode command line tools installed: + +``` +xcode-select --install +``` + +Install _fastlane_ using +``` +[sudo] gem install fastlane -NV +``` +or alternatively using `brew install fastlane` + +# Available Actions +## Android +### android test +``` +fastlane android test +``` +Runs all the tests +### android beta +``` +fastlane android beta +``` +Submit a new Beta Build to Crashlytics Beta +### android deploy +``` +fastlane android deploy +``` +Deploy a new version to the Google Play +### android deployMeta +``` +fastlane android deployMeta +``` +Deploy Google Play metadata +### android getVersionCode +``` +fastlane android getVersionCode +``` +Get version code + +---- + +This README.md is auto-generated and will be re-generated every time [fastlane](https://fastlane.tools) is run. +More information about fastlane can be found on [fastlane.tools](https://fastlane.tools). +The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools). diff --git a/tools/release/pushPlayStoreMetaData.sh b/tools/release/pushPlayStoreMetaData.sh new file mode 100755 index 0000000000..0025c1878d --- /dev/null +++ b/tools/release/pushPlayStoreMetaData.sh @@ -0,0 +1,108 @@ +#!/usr/bin/env bash + +# +# Copyright (c) 2021 New Vector Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set +e + +# Fastlane / PlayStore is not happy if the folder name for local is not supported by the PlayStore. So temporary move them before running fast lane + +echo "Ignoring some languages not supported by the PlayStore" +mkdir ./fastlane_tmp +mv ./fastlane/metadata/android/eo ./fastlane_tmp +mv ./fastlane/metadata/android/fy ./fastlane_tmp +mv ./fastlane/metadata/android/ga ./fastlane_tmp +mv ./fastlane/metadata/android/kab ./fastlane_tmp +mv ./fastlane/metadata/android/nb ./fastlane_tmp + +# Fastlane / PlayStore require longDescription and shortDescription file to be set, so copy the default one for +echo "Copying default description when missing" +if [[ -f "./fastlane/metadata/android/ro/full_description.txt" ]]; then + echo "It appears that file ./fastlane/metadata/android/ro/full_description.txt now exists. This can be removed." + removeFullDes_ro=0 +else + echo "Copy default full description to ./fastlane/metadata/android/ro" + cp ./fastlane/metadata/android/en-US/full_description.txt ./fastlane/metadata/android/ro + removeFullDes_ro=1 +fi + +if [[ -f "./fastlane/metadata/android/si-LK/full_description.txt" ]]; then + echo "It appears that file ./fastlane/metadata/android/si-LK/full_description.txt now exists. This can be removed." + removeFullDes_si=0 +else + echo "Copy default full description to ./fastlane/metadata/android/si-LK" + cp ./fastlane/metadata/android/en-US/full_description.txt ./fastlane/metadata/android/si-LK + removeFullDes_si=1 +fi + +if [[ -f "./fastlane/metadata/android/si-LK/short_description.txt" ]]; then + echo "It appears that file ./fastlane/metadata/android/si-LK/short_description.txt now exists. This can be removed." + removeShortDes_si=0 +else + echo "Copy default short description to ./fastlane/metadata/android/si-LK" + cp ./fastlane/metadata/android/en-US/short_description.txt ./fastlane/metadata/android/si-LK + removeShortDes_si=1 +fi + +if [[ -f "./fastlane/metadata/android/th/full_description.txt" ]]; then + echo "It appears that file ./fastlane/metadata/android/th/full_description.txt now exists. This can be removed." + removeFullDes_th=0 +else + echo "Copy default full description to ./fastlane/metadata/android/th" + cp ./fastlane/metadata/android/en-US/full_description.txt ./fastlane/metadata/android/th + removeFullDes_th=1 +fi + +if [[ -f "./fastlane/metadata/android/vi/full_description.txt" ]]; then + echo "It appears that file ./fastlane/metadata/android/vi/full_description.txt now exists. This can be removed." + removeFullDes_vi=0 +else + echo "Copy default full description to ./fastlane/metadata/android/vi" + cp ./fastlane/metadata/android/en-US/full_description.txt ./fastlane/metadata/android/vi + removeFullDes_vi=1 +fi + +# Run fastlane +echo "Run fastlane to push to the PlaysStore" +fastlane deployMeta + +echo "Cleanup" +mv ./fastlane_tmp/* ./fastlane/metadata/android/ + +# Delete the tmp folder (should be empty) +rmdir ./fastlane_tmp + +if [[ ${removeFullDes_ro} -eq 1 ]]; then + rm ./fastlane/metadata/android/ro/full_description.txt +fi + +if [[ ${removeFullDes_si} -eq 1 ]]; then + rm ./fastlane/metadata/android/si-LK/full_description.txt +fi + +if [[ ${removeShortDes_si} -eq 1 ]]; then + rm ./fastlane/metadata/android/si-LK/short_description.txt +fi + +if [[ ${removeFullDes_th} -eq 1 ]]; then + rm ./fastlane/metadata/android/th/full_description.txt +fi + +if [[ ${removeFullDes_vi} -eq 1 ]]; then + rm ./fastlane/metadata/android/vi/full_description.txt +fi + +echo "Success!"