update lane documentation

This commit is contained in:
Gergely Hegedus 2023-09-11 10:23:30 +03:00
parent aab4e2fe98
commit 8fcdca1305
4 changed files with 111 additions and 37 deletions

View file

@ -18,16 +18,20 @@ default_platform(:android)
platform :android do platform :android do
before_all do before_all do
# Firebase's internal app id, find it on the Firebase website
FIREBASE_APP_DISTRIBUTION_APP_STAGING = "1:64659984801:android:7a0514333a32b8c5f43be0" FIREBASE_APP_DISTRIBUTION_APP_STAGING = "1:64659984801:android:7a0514333a32b8c5f43be0"
# Firebase's testing group
FIREBASE_APP_DISTRIBUTION_GROUPS_QA = "android-qa" FIREBASE_APP_DISTRIBUTION_GROUPS_QA = "android-qa"
# Environment variable, service account key to authenticate with firebase
FIREBASE_SERVICE_ACCOUNT_FILE = ENV['CI_EVALUATION_FIREBASE_SERVICE_ACCOUNT_FILE'] FIREBASE_SERVICE_ACCOUNT_FILE = ENV['CI_EVALUATION_FIREBASE_SERVICE_ACCOUNT_FILE']
# Environment variable, service account key to authenticate with PlayStore
PLAYSTORE_SERVICE_ACCOUNT_FILE = ENV['CI_EVALUATION_PLAYSTORE_SERVICE_ACCOUNT_FILE'] PLAYSTORE_SERVICE_ACCOUNT_FILE = ENV['CI_EVALUATION_PLAYSTORE_SERVICE_ACCOUNT_FILE']
end end
desc "Submit a new Internal Build to Firebase" desc "Submit a new Internal Build to Firebase"
desc ">Optionally release notes can be added like so:" desc ">Optionally release notes can be added like so:"
desc "```sh" desc "```sh"
desc "[bundle exec] fastlane deployInternalFirebase release_notes:testing" desc "[bundle exec] fastlane deployInternalFirebase release_notes:\"testing notes\""
desc "```" desc "```"
lane :deployInternalFirebase do |options| lane :deployInternalFirebase do |options|
release_notes = options[:release_notes] release_notes = options[:release_notes]
@ -49,6 +53,8 @@ platform :android do
) )
end end
desc "Create new Release APK"
desc "Find it under app/build/outputs/apk/release"
lane :buildReleaseApk do lane :buildReleaseApk do
gradle(task: 'clean', flags: "--no-daemon") gradle(task: 'clean', flags: "--no-daemon")
gradle( gradle(
@ -62,11 +68,16 @@ platform :android do
end end
desc "Submit a new Production Build to Play Store" desc "Submit a new Production Build to Play Store"
desc "By Default it sets the version_code to last from PlayStore + 1."
desc ">Optionally version code increase can be skipped via:"
desc "```sh"
desc "[bundle exec] fastlane deployInternalFirebase skip_build_number_increase:1"
desc "```"
lane :deployProdPlayStore do |options| lane :deployProdPlayStore do |options|
version_code = options[:version_code] # optional, if not set, it gets the last from PlayStore then adds + 1 skip_build_number_increase = options[:skip_build_number_increase] # optional, if not set, it gets the last from TestFlight then adds + 1
package_name = "com.initproject.prod" package_name = "com.initproject.prod"
if version_code.nil? if skip_build_number_increase.nil?
last_version_codes = google_play_track_version_codes( last_version_codes = google_play_track_version_codes(
track: 'internal', track: 'internal',
json_key: PLAYSTORE_SERVICE_ACCOUNT_FILE, json_key: PLAYSTORE_SERVICE_ACCOUNT_FILE,

View file

@ -27,7 +27,7 @@ Submit a new Internal Build to Firebase
```sh ```sh
[bundle exec] fastlane deployInternalFirebase release_notes:testing [bundle exec] fastlane deployInternalFirebase release_notes:"testing notes"
``` ```
@ -37,7 +37,9 @@ Submit a new Internal Build to Firebase
[bundle exec] fastlane android buildReleaseApk [bundle exec] fastlane android buildReleaseApk
``` ```
Create new Release APK
Find it under app/build/outputs/apk/release
### android deployProdPlayStore ### android deployProdPlayStore
@ -47,6 +49,16 @@ Submit a new Internal Build to Firebase
Submit a new Production Build to Play Store Submit a new Production Build to Play Store
By Default it sets the version_code to last from Playstore + 1.
>Optionally version code increase can be skipped via:
```sh
[bundle exec] fastlane deployInternalFirebase skip_build_number_increase:1
```
---- ----
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run. This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.

View file

@ -18,21 +18,37 @@ default_platform(:ios)
platform :ios do platform :ios do
before_all do before_all do
# Firebase's internal app id, find it on the Firebase website
FIREBASE_APP_DISTRIBUTION_APP_STAGING = "1:64659984801:ios:a9c4640d2a1960a5f43be0" FIREBASE_APP_DISTRIBUTION_APP_STAGING = "1:64659984801:ios:a9c4640d2a1960a5f43be0"
# Firebase's testing group
FIREBASE_APP_DISTRIBUTION_GROUPS_QA = "ios-qa" FIREBASE_APP_DISTRIBUTION_GROUPS_QA = "ios-qa"
FIREBASE_SERVICE_ACCOUNT_FILE = ENV['CI_EVALUATION_FIREBASE_SERVICE_ACCOUNT_FILE'] # name of the keychain created while signing
KEYCHAIN_NAME = "temp_keychain" KEYCHAIN_NAME = "temp_keychain"
PROVISIONING_PROFILE_FILE = ENV['CI_EVALUATION_PROVISIONING_PROFILE_FILE']
CERTIFICATE_PASSWORD = ENV['CI_EVALUATION_CERTIFICATE_PASSWORD'].strip # Environment variable, service account key to authenticate with firebase
PROVISIONING_PROFILE_FILE = "#{ENV['HOME']}/Library/MobileDevice/Provisioning Profiles/profile.mobileprovision" FIREBASE_SERVICE_ACCOUNT_FILE = ENV['CI_EVALUATION_FIREBASE_SERVICE_ACCOUNT_FILE']
# full path to the signing certificate. Created on the Apple Developer portal, then exported from keychain, usually as p12.
IOS_CERT_FILE = ENV['CI_EVALUATION_IOS_CERT_FILE'] IOS_CERT_FILE = ENV['CI_EVALUATION_IOS_CERT_FILE']
# password to the certificate
CERTIFICATE_PASSWORD = ENV['CI_EVALUATION_CERTIFICATE_PASSWORD'].strip
# full path to the provisioning profile, the file name comes from Environment variable
# created on the Apple Developer portal
PROVISIONING_PROFILE_FILE = "#{ENV['HOME']}/Library/MobileDevice/Provisioning Profiles/profile.mobileprovision"
# App identifier Environment variable, copied from the Apple Developer portal
APP_IDENTIFIER = ENV['CI_EVALUATION_APP_IDENTIFIER'] APP_IDENTIFIER = ENV['CI_EVALUATION_APP_IDENTIFIER']
# App Api Key File, created on the Apple Developer portal
APP_STORE_API_KEY_FILE = ENV['CI_EVALUATION_APP_STORE_API_KEY_FILE'] APP_STORE_API_KEY_FILE = ENV['CI_EVALUATION_APP_STORE_API_KEY_FILE']
# App KeyId Environment variable, copied from the Apple Developer portal
APP_STORE_API_KEY_ID = ENV['CI_EVALUATION_APP_STORE_API_KEY_ID'] APP_STORE_API_KEY_ID = ENV['CI_EVALUATION_APP_STORE_API_KEY_ID']
# App Key Issuer Environment variable, copied from the Apple Developer portal
APP_STORE_API_KEY_ISSUER_ID = ENV['CI_EVALUATION_APP_STORE_API_KEY_ISSUER_ID'] APP_STORE_API_KEY_ISSUER_ID = ENV['CI_EVALUATION_APP_STORE_API_KEY_ISSUER_ID']
end end
desc "Description of what the lane does" desc "Creates Release Signed build and publishes it to firebase"
desc ">Optionally release notes can be added like so:"
desc "```sh"
desc "[bundle exec] fastlane deployInternalFirebase release_notes:\"testing notes\""
desc "```"
lane :deployInternalFirebase do |options| lane :deployInternalFirebase do |options|
release_notes = options[:release_notes] release_notes = options[:release_notes]
if release_notes.nil? if release_notes.nil?
@ -53,35 +69,42 @@ platform :ios do
cleanupKeyChain() cleanupKeyChain()
end end
desc "Description of what the lane does" desc "Submit a new Production Build to TestFlight"
lane :deployToTestFlight do |options| desc "By Default it sets the version_code to last from TestFlight + 1."
skip_build_number_increase = options[:skip_build_number_increase] # optional, if not set, it gets the last from TestFlight then adds + 1 desc ">Optionally version code increase can be skipped via:"
app_store_connect_api_key( desc "```sh"
key_id: APP_STORE_API_KEY_ID, desc "[bundle exec] fastlane deployInternalFirebase skip_build_number_increase:1"
issuer_id: APP_STORE_API_KEY_ISSUER_ID, desc "```"
key_filepath: APP_STORE_API_KEY_FILE, lane :deployToTestFlight do |options|
is_key_content_base64: false, skip_build_number_increase = options[:skip_build_number_increase] # optional, if not set, it gets the last from TestFlight then adds + 1
in_house: false # optional but may be required if using match/sigh app_store_connect_api_key(
) key_id: APP_STORE_API_KEY_ID,
issuer_id: APP_STORE_API_KEY_ISSUER_ID,
key_filepath: APP_STORE_API_KEY_FILE,
is_key_content_base64: false,
in_house: false # optional but may be required if using match/sigh
)
if skip_build_number_increase.nil? if skip_build_number_increase.nil?
increment_build_number({ increment_build_number({
build_number: latest_testflight_build_number(app_identifier: APP_IDENTIFIER) + 1 build_number: latest_testflight_build_number(app_identifier: APP_IDENTIFIER) + 1
}) })
end
setupCodeSigning()
ipa_name = "Release.ipa"
buildReleaseIPA(ipa_name: ipa_name, method: "app-store")
upload_to_testflight(
skip_submission: true,
ipa: "./builds/#{ipa_name}",
skip_waiting_for_build_processing: true,
)
cleanupKeyChain()
end end
setupCodeSigning()
ipa_name = "Release.ipa"
buildReleaseIPA(ipa_name: ipa_name, method: "app-store")
upload_to_testflight(
skip_submission: true,
ipa: "./builds/#{ipa_name}",
skip_waiting_for_build_processing: true,
)
cleanupKeyChain()
end
desc "Create new Release IPA"
desc "Find it under ios/builds"
lane :buildReleaseIPA do |options| lane :buildReleaseIPA do |options|
ipa_name = options[:ipa_name] ipa_name = options[:ipa_name]
method = options[:method] method = options[:method]
@ -101,6 +124,8 @@ platform :ios do
) )
end end
desc "Sets up the and initialises the required authentications and project configurations to sign a build"
desc "Creates a temporary keychain which should be deleted at the end, see :cleanupKeyChain"
lane :setupCodeSigning do lane :setupCodeSigning do
password = (0...50).map { ('a'..'z').to_a[rand(26)] }.join password = (0...50).map { ('a'..'z').to_a[rand(26)] }.join
cleanupKeyChain() cleanupKeyChain()
@ -139,6 +164,8 @@ platform :ios do
) )
end end
desc "Deletes the temporary keychain if it exists"
desc "The keychain is created via :setupCodeSigning"
lane :cleanupKeyChain do lane :cleanupKeyChain do
begin begin
delete_keychain(name: KEYCHAIN_NAME) if File.exist? File.expand_path("/Users/runner/Library/Keychains/#{KEYCHAIN_NAME}-db") delete_keychain(name: KEYCHAIN_NAME) if File.exist? File.expand_path("/Users/runner/Library/Keychains/#{KEYCHAIN_NAME}-db")

View file

@ -21,7 +21,15 @@ For _fastlane_ installation instructions, see [Installing _fastlane_](https://do
[bundle exec] fastlane ios deployInternalFirebase [bundle exec] fastlane ios deployInternalFirebase
``` ```
Description of what the lane does Creates Release Signed build and publishes it to firebase
>Optionally release notes can be added like so:
```sh
[bundle exec] fastlane deployInternalFirebase release_notes:"testing notes"
```
### ios deployToTestFlight ### ios deployToTestFlight
@ -29,7 +37,17 @@ Description of what the lane does
[bundle exec] fastlane ios deployToTestFlight [bundle exec] fastlane ios deployToTestFlight
``` ```
Description of what the lane does Submit a new Production Build to TestFlight
By Default it sets the version_code to last from TestFlight + 1.
>Optionally version code increase can be skipped via:
```sh
[bundle exec] fastlane deployInternalFirebase skip_build_number_increase:1
```
### ios buildReleaseIPA ### ios buildReleaseIPA
@ -37,7 +55,9 @@ Description of what the lane does
[bundle exec] fastlane ios buildReleaseIPA [bundle exec] fastlane ios buildReleaseIPA
``` ```
Create new Release IPA
Find it under ios/builds
### ios setupCodeSigning ### ios setupCodeSigning
@ -45,7 +65,9 @@ Description of what the lane does
[bundle exec] fastlane ios setupCodeSigning [bundle exec] fastlane ios setupCodeSigning
``` ```
Sets up the and initialises the required authentications and project configurations to sign a build
Creates a temporary keychain which should be deleted at the end, see :cleanupKeyChain
### ios cleanupKeyChain ### ios cleanupKeyChain
@ -53,7 +75,9 @@ Description of what the lane does
[bundle exec] fastlane ios cleanupKeyChain [bundle exec] fastlane ios cleanupKeyChain
``` ```
Deletes the temporary keychain if it exists
The keychain is created via :setupCodeSigning
---- ----