From 4b258234e0019f09b4025acf1c9fa40be4e96c2b Mon Sep 17 00:00:00 2001 From: Rainer Killinger Date: Fri, 18 Feb 2022 11:43:57 +0100 Subject: [PATCH] refactor: enable CI only configuration --- .gitignore | 3 --- app.conf.sample | 37 +++++++++++++++++------------ playstore_api_key.json.sample | 3 --- static/fastlane-android/Appfile | 2 +- static/fastlane-android/Fastfile | 15 +++++------- static/fastlane-ios/Fastfile | 40 +++++++++++++++++++++++++++++--- 6 files changed, 66 insertions(+), 34 deletions(-) delete mode 100644 playstore_api_key.json.sample diff --git a/.gitignore b/.gitignore index d98a0bec..58e1763a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,2 @@ app -playstore_api_key.json -playstore.keystore -app.conf Gemfile.lock \ No newline at end of file diff --git a/app.conf.sample b/app.conf.sample index 95b5e37d..202b77f1 100644 --- a/app.conf.sample +++ b/app.conf.sample @@ -1,21 +1,27 @@ -# Edit the following entires if necessary +# Edit the following entires and save the file without .sample extension -APP_NAME="Open StApps" # Full app name -APP_DISPLAY_NAME="StApps" # App name on mobile device homescreen (Not much space) -BACKEND_URL="https://your.backend.server.tld" # Publicly available backend url -BACKEND_VERSION="2.0.0" # Minimum backend version the app will request -APP_LINK_HOST="your.deep.link.host.tld" # Your host used for universal (deep) links -APP_URL_SCHEME="de.anyschool.app" # Custom url scheme for native app versions +APP_NAME="Open StApps" # Full app name +APP_DISPLAY_NAME="StApps" # App name on mobile device homescreen (Not much space) +BACKEND_URL="https://your.backend.server.tld" # Publicly available backend url +BACKEND_VERSION="2.0.0" # Minimum backend version the app will request +APP_LINK_HOST="your.deep.link.host.tld" # Your host used for universal (deep) links +APP_URL_SCHEME="de.anyschool.app" # Custom url scheme for native app versions -# iOS specific sonfiguration +# iOS specific configuration LOCATION_USAGE_DESCRIPTION="Ortungsdienste werden für die Kartenansichten und bessere Suchergebnisse benötigt" CALENDAR_USAGE_DESCRIPTION="Zugriff auf Kalender wird für die Synchronisierung deiner Uni Termine benötigt" -IOS_BUNDLE_IDENTIFIER="com.anyschool.app.ios" # The bundle identifier of your ios app -APPLE_ID="example@domain.tld" # Your Apple Developer email address -ITC_TEAM_ID="123412345" # App Store Connect Team ID -TEAM_ID="ABCDEV1234" # Developer Team ID +IOS_BUNDLE_IDENTIFIER="com.anyschool.app.ios" # The bundle identifier of your ios app +APPLE_ID="example@domain.tld" # Your Apple Developer email address +ITC_TEAM_ID="123412345" # App Store Connect Team ID +TEAM_ID="ABCDEV1234" # Developer Team ID +APPLE_API_KEY_ID="123ACAB456" # Your API key id +APPLE_API_KEY_ISSUER_ID="1234578-1234-1234-1234-12345678901" # Your API key issuer id + +# Provide the following environment variable in a secure fashion. +# Don't change the following line! +APPLE_API_KEY_CONTENT="${APPLE_API_KEY_CONTENT:-'unset'}" # Base64 encoded contents of Apple API key file (.p8 file) # Android specific configuration @@ -24,6 +30,7 @@ ANDROID_PACKAGE_NAME="de.anyschool.app.android" # Your # Provide the following environment variables in a secure fashion. # Don't change the following lines! -ANDROID_KEYSTORE_PASSWORD="${ANDROID_KEYSTORE_PASSWORD:-'unsed'}" # Passwort to your keyfile -ANDROID_KEYSTORE_KEY_ALIAS="${ANDROID_KEYSTORE_KEY_ALIAS:-'unsed'}" # Name/Alias of the key used for signing within the keyfile -ANDROID_KEYSTORE_KEY_PASSWORD="${ANDROID_KEYSTORE_KEY_PASSWORD:-'unsed'}" # Passwort to the this very key +ANDROID_API_KEY_CONTENT="${ANDROID_API_KEY_CONTENT:-'unset'}" # Base64 encoded contents of your API key file (.json file) +ANDROID_KEYSTORE_PASSWORD="${ANDROID_KEYSTORE_PASSWORD:-'unset'}" # Passwort to your keyfile +ANDROID_KEYSTORE_KEY_ALIAS="${ANDROID_KEYSTORE_KEY_ALIAS:-'unset'}" # Name/Alias of the key used for signing within the keyfile +ANDROID_KEYSTORE_KEY_PASSWORD="${ANDROID_KEYSTORE_KEY_PASSWORD:-'unset'}" # Passwort to the this very key diff --git a/playstore_api_key.json.sample b/playstore_api_key.json.sample deleted file mode 100644 index bcdf77c3..00000000 --- a/playstore_api_key.json.sample +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hint": "Replace this with the content of your valid playstore api key json file and remove '.sample' from file name" -} \ No newline at end of file diff --git a/static/fastlane-android/Appfile b/static/fastlane-android/Appfile index dd52a0e0..e6c604b0 100644 --- a/static/fastlane-android/Appfile +++ b/static/fastlane-android/Appfile @@ -1,2 +1,2 @@ -json_key_file("../../playstore_api_key.json") # Don't Change +#json_key_file("../../playstore_api_key.json") # Don't Change package_name ENV["ANDROID_PACKAGE_NAME"] || "de.anyschool.app.droid" # Don't Change \ No newline at end of file diff --git a/static/fastlane-android/Fastfile b/static/fastlane-android/Fastfile index 4c4c3634..c758d6d5 100644 --- a/static/fastlane-android/Fastfile +++ b/static/fastlane-android/Fastfile @@ -14,6 +14,7 @@ # update_fastlane require 'json' +require 'base64' default_platform(:android) @@ -22,16 +23,12 @@ playstore_track = "internal" package_json = JSON.parse(File.read('../../package.json')) platform :android do - desc "Runs all the tests" - lane :test do - gradle(task: "test") - end lane :fetch_version_code do current_version_code = google_play_track_version_codes( package_name: ENV['ANDROID_PACKAGE_NAME'], track: playstore_track, - json_key: '../../playstore_api_key.json' + json_key_data: ENV['ANDROID_API_KEY_CONTENT'] ).max end @@ -40,9 +37,9 @@ platform :android do tracks = ['production', 'beta', 'internal'] tracks.each do |t| version_code_candidates += google_play_track_version_codes( - package_name: ENV['ANDROID_PACKAGE_NAME'], + package_name: ENV['ANDROID_PACKAGE_NAME'], track: t, - json_key: '../../playstore_api_key.json' + json_key_data: Base64.decode64(ENV['ANDROID_API_KEY_CONTENT']) ) end current_version_code = version_code_candidates.compact.max @@ -72,14 +69,14 @@ platform :android do build upload_to_play_store( track: playstore_track, - json_key: '../../playstore_api_key.json', + json_key_data: Base64.decode64(ENV['ANDROID_API_KEY_CONTENT']), skip_upload_metadata: true, skip_upload_images: true, skip_upload_screenshots: true ) end - desc "Deploy a new version to the Google Play" + desc "Submit a new version to the Google Play" lane :release do build #upload_to_play_store(json_key: '../../playstore_api_key.json', skip_upload_metadata: true, skip_upload_images: true) diff --git a/static/fastlane-ios/Fastfile b/static/fastlane-ios/Fastfile index ecf7ee4f..a5ea4e53 100644 --- a/static/fastlane-ios/Fastfile +++ b/static/fastlane-ios/Fastfile @@ -17,10 +17,34 @@ require 'json' default_platform(:ios) +current_build_number = 1 package_json = JSON.parse(File.read('../../../package.json')) +api_key = app_store_connect_api_key( + key_id: ENV['APPLE_API_KEY_ID'], + issuer_id: ENV['APPLE_API_KEY_ISSUER_ID'], + key_content: ENV['APPLE_API_KEY_CONTENT'], + is_key_content_base64: true, + duration: 1000, + in_house: false +) + platform :ios do - desc "Push a new release build to the App Store" + + lane :fetch_highest_build_number do + build_number_candidates = [1] + build_number_candidates += latest_testflight_build_number( + version: package_json['version'], + initial_build_number: 1, + api_key: api_key + ) + build_number_candidates += app_store_build_number( + version: package_json['version'], + initial_build_number: 1, + api_key: api_key + ) + current_build_number = build_number_candidates.compact.max + end lane :configure do set_info_plist_value( @@ -53,21 +77,31 @@ platform :ios do version_number: package_json['version'], xcodeproj: "App.xcodeproj" ) + fetch_highest_build_number + increment_build_number( + build_number: current_build_number + 1, + xcodeproj: "App.xcodeproj" + ) end lane :build do build_app(workspace: "App.xcworkspace", scheme: "App") end + desc "Submit a new version to iOS App Store" lane :release do configure build - #upload_to_app_store(skip_metadata: true, skip_screenshots: true) + #upload_to_app_store(skip_metadata: true, skip_screenshots: true, api_key: api_key) end + desc "Submit a new version to Testflight" lane :beta do configure build - upload_to_testflight(skip_submission: true) + upload_to_testflight( + skip_submission: true, + api_key: api_key + ) end end \ No newline at end of file