update pipeline variables

This commit is contained in:
Gergely Hegedus 2023-09-11 15:10:12 +03:00
parent 43df9b5db2
commit 0b46efff1f
6 changed files with 208 additions and 182 deletions

View file

@ -11,51 +11,45 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
cache: gradle
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Set up Ruby & Fastlane
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
with:
ruby-version: '3.2.1'
bundler-cache: true
working-directory: ./android
- name: node_modules cache
uses: actions/cache@v3
id: npm-cache
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-
- name: Install Dependencies
run: npm ci
- name: Restore Release Keystore
env:
keystore_base64: ${{ secrets.RELEASE_KEYSTORE_BASE64 }}
run: |
echo "$keystore_base64" | base64 --decode > release.keystore
echo "CI_EVALUATION_KEYSTORE_FILE=`pwd`/release.keystore" >> $GITHUB_ENV
- name: Set up Ruby & Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.1'
bundler-cache: true
working-directory: ./android
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
# caching currently disabled, because the files are large, but don't decrease built time too much
#cache: gradle
- name: Restore Firebase Service Account
env:
firebase_service_account_base64: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_BASE64 }}
firebase_service_account_base64: ${{ secrets.CI_EVAL_FIREBASE_DISTRIBUTION_AUTH_BASE64 }}
run: |
echo "$firebase_service_account_base64" | base64 --decode > firebase-distribution-service-account.json
echo "CI_EVALUATION_FIREBASE_SERVICE_ACCOUNT_FILE=`pwd`/firebase-distribution-service-account.json" >> $GITHUB_ENV
echo "CI_EVAL_FIREBASE_DISTRIBUTION_AUTH_FILE=`pwd`/firebase-distribution-service-account.json" >> $GITHUB_ENV
- name: Deploy to Firebase
env:
CI_EVALUATION_KEY_ALIAS: ${{ secrets.CI_EVALUATION_KEY_ALIAS }}
CI_EVALUATION_KEY_PASSWORD: ${{ secrets.CI_EVALUATION_KEY_PASSWORD }}
CI_EVALUATION_STORE_PASSWORD: ${{ secrets.CI_EVALUATION_STORE_PASSWORD }}
working-directory: ./android
run: bundle exec fastlane deployInternalFirebase
run: bundle exec fastlane deployInternalToFirebase
ios-publish-to-firebase:
runs-on: macos-latest
@ -69,12 +63,6 @@ jobs:
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Set up Ruby & Fastlane
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
with:
ruby-version: '3.2.1'
bundler-cache: true
working-directory: ./ios
- name: node_modules cache
uses: actions/cache@v3
id: npm-cache
@ -84,6 +72,13 @@ jobs:
restore-keys: ${{ runner.os }}-npm-
- name: Install Dependencies
run: npm ci
- name: Set up Ruby & Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.1'
bundler-cache: true
working-directory: ./ios
- name: pod install cache
uses: actions/cache@v3
id: pod-cache
@ -94,29 +89,31 @@ jobs:
- name: Install iOS Dependencies
working-directory: ./ios
run: pod install
- name: Restore Firebase Service Account
env:
firebase_service_account_base64: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_BASE64 }}
firebase_service_account_base64: ${{ secrets.CI_EVAL_FIREBASE_DISTRIBUTION_AUTH_BASE64 }}
run: |
echo "$firebase_service_account_base64" | base64 --decode > firebase-distribution-service-account.json
echo "CI_EVALUATION_FIREBASE_SERVICE_ACCOUNT_FILE=`pwd`/firebase-distribution-service-account.json" >> $GITHUB_ENV
- name: Restore Provisioning Profile
echo "CI_EVAL_FIREBASE_DISTRIBUTION_AUTH_FILE=`pwd`/firebase-distribution-service-account.json" >> $GITHUB_ENV
- name: Restore Internal Provisioning Profile
env:
ci_evaluation_provision_profile_base64: ${{ secrets.CI_EVALUATION_PROVISION_PROFILE_BASE64 }}
provision_profile_base64: ${{ secrets.CI_EVAL_IOS_PROVISIONING_PROFILE_INTERNAL_BASE64 }}
run: |
echo "$ci_evaluation_provision_profile_base64" | base64 --decode > profile.mobileprovision
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp profile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/profile.mobileprovision
echo "CI_EVALUATION_PROVISIONING_PROFILE_FILE=\"~/Library/MobileDevice/Provisioning Profiles/profile.mobileprovision\"" >> $GITHUB_ENV
echo "$provision_profile_base64" | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/internal_profile.mobileprovision
echo "CI_EVAL_IOS_PROVISIONING_PROFILE_INTERNAL_FILENAME=internal_profile.mobileprovision" >> $GITHUB_ENV
- name: Restore iOS Cert
env:
ci_evaluation_cert_base64: ${{ secrets.CI_EVALUATION_CERT_BASE64 }}
ios_cert_base64: ${{ secrets.CI_EVAL_IOS_CERT_BASE64 }}
run: |
echo "$ci_evaluation_cert_base64" | base64 --decode > ios_distribution.p12
echo "CI_EVALUATION_IOS_CERT_FILE=`pwd`/ios_distribution.p12" >> $GITHUB_ENV
echo "$ios_cert_base64" | base64 --decode > ios_distribution.p12
echo "CI_EVAL_IOS_CERT_FILE=`pwd`/ios_distribution.p12" >> $GITHUB_ENV
- name: Deploy to Firebase
env:
CI_EVALUATION_CERTIFICATE_PASSWORD: ${{ secrets.CI_EVALUATION_CERTIFICATE_PASSWORD }}
CI_EVALUATION_APP_IDENTIFIER: ${{ secrets.CI_EVALUATION_APP_IDENTIFIER }}
CI_EVAL_IOS_CERT_PASSWORD: ${{ secrets.CI_EVAL_IOS_CERT_PASSWORD }}
CI_EVAL_INTERNAL_APP_IDENTIFIER: ${{ secrets.CI_EVAL_INTERNAL_APP_IDENTIFIER }}
working-directory: ./ios
run: bundle exec fastlane deployInternalFirebase
run: bundle exec fastlane deployInternalToFirebase

View file

@ -11,51 +11,54 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
cache: gradle
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Set up Ruby & Fastlane
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
with:
ruby-version: '3.2.1'
bundler-cache: true
working-directory: ./android
- name: node_modules cache
uses: actions/cache@v3
id: npm-cache
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-
- name: Install Dependencies
run: npm ci
- name: Set up Ruby & Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.1'
bundler-cache: true
working-directory: ./android
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
# caching currently disabled, because the files are large, but don't decrease built time too much
#cache: gradle
- name: Restore Release Keystore
env:
keystore_base64: ${{ secrets.RELEASE_KEYSTORE_BASE64 }}
keystore_base64: ${{ secrets.CI_EVAL_ANDROID_KEYSTORE_BASE64 }}
run: |
echo "$keystore_base64" | base64 --decode > release.keystore
echo "CI_EVALUATION_KEYSTORE_FILE=`pwd`/release.keystore" >> $GITHUB_ENV
echo "CI_EVAL_ANDROID_KEYSTORE_FILE=`pwd`/release.keystore" >> $GITHUB_ENV
- name: Restore PlayStore Service Account
env:
play_store_service_account_base64: ${{ secrets.PLAY_STORE_SERVICE_ACCOUNT_BASE64 }}
play_store_service_account_base64: ${{ secrets.CI_EVAL_ANDROID_PLAY_STORE_AUTH_BASE64 }}
run: |
echo "$play_store_service_account_base64" | base64 --decode > play-store-distribution-service-account.json
echo "CI_EVALUATION_PLAYSTORE_SERVICE_ACCOUNT_FILE=`pwd`/play-store-distribution-service-account.json" >> $GITHUB_ENV
echo "CI_EVAL_ANDROID_PLAY_STORE_AUTH_FILE=`pwd`/play-store-distribution-service-account.json" >> $GITHUB_ENV
- name: Deploy to Play Store Internal Track
env:
CI_EVALUATION_KEY_ALIAS: ${{ secrets.CI_EVALUATION_KEY_ALIAS }}
CI_EVALUATION_KEY_PASSWORD: ${{ secrets.CI_EVALUATION_KEY_PASSWORD }}
CI_EVALUATION_STORE_PASSWORD: ${{ secrets.CI_EVALUATION_STORE_PASSWORD }}
CI_EVAL_ANDROID_KEYSTORE_KEY_ALIAS: ${{ secrets.CI_EVAL_ANDROID_KEYSTORE_KEY_ALIAS }}
CI_EVAL_ANDROID_KEYSTORE_KEY_PASSWORD: ${{ secrets.CI_EVAL_ANDROID_KEYSTORE_KEY_PASSWORD }}
CI_EVAL_ANDROID_KEYSTORE_STORE_PASSWORD: ${{ secrets.CI_EVAL_ANDROID_KEYSTORE_STORE_PASSWORD }}
working-directory: ./android
run: bundle exec fastlane deployProdPlayStore
run: bundle exec fastlane deployProdToPlayStore
ios-publish-to-testflight:
runs-on: macos-latest
@ -69,12 +72,6 @@ jobs:
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Set up Ruby & Fastlane
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
with:
ruby-version: '3.2.1'
bundler-cache: true
working-directory: ./ios
- name: node_modules cache
uses: actions/cache@v3
id: npm-cache
@ -84,6 +81,13 @@ jobs:
restore-keys: ${{ runner.os }}-npm-
- name: Install Dependencies
run: npm ci
- name: Set up Ruby & Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.1'
bundler-cache: true
working-directory: ./ios
- name: pod install cache
uses: actions/cache@v3
id: pod-cache
@ -94,31 +98,33 @@ jobs:
- name: Install iOS Dependencies
working-directory: ./ios
run: pod install
- name: Restore Provisioning Profile
- name: Restore Prod Provisioning Profile
env:
ci_evaluation_provision_profile_base64: ${{ secrets.CI_EVALUATION_APPSTORE_PROVISION_PROFILE_BASE64 }}
provision_profile_base64: ${{ secrets.CI_EVAL_IOS_PROVISIONING_PROFILE_PROD_BASE64 }}
run: |
echo "$ci_evaluation_provision_profile_base64" | base64 --decode > profile.mobileprovision
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp profile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/profile.mobileprovision
echo "CI_EVALUATION_PROVISIONING_PROFILE_FILE=\"~/Library/MobileDevice/Provisioning Profiles/profile.mobileprovision\"" >> $GITHUB_ENV
echo "$provision_profile_base64" | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/prod_profile.mobileprovision
echo "CI_EVAL_IOS_PROVISIONING_PROFILE_PROD_FILENAME=prod_profile.mobileprovision" >> $GITHUB_ENV
- name: Restore iOS Cert
env:
ci_evaluation_cert_base64: ${{ secrets.CI_EVALUATION_CERT_BASE64 }}
ios_cert_base64: ${{ secrets.CI_EVAL_IOS_CERT_BASE64 }}
run: |
echo "$ci_evaluation_cert_base64" | base64 --decode > ios_distribution.p12
echo "CI_EVALUATION_IOS_CERT_FILE=`pwd`/ios_distribution.p12" >> $GITHUB_ENV
echo "$ios_cert_base64" | base64 --decode > ios_distribution.p12
echo "CI_EVAL_IOS_CERT_FILE=`pwd`/ios_distribution.p12" >> $GITHUB_ENV
- name: Restore App Store API Key
env:
app_store_api_key_base64: ${{ secrets.APP_STORE_API_KEY_BASE64 }}
app_store_api_key_base64: ${{ secrets.CI_EVAL_IOS_APP_STORE_KEY_FILE_BASE64 }}
run: |
echo "$app_store_api_key_base64" | base64 --decode > api_key.p8
echo "CI_EVALUATION_APP_STORE_API_KEY_FILE=`pwd`/api_key.p8" >> $GITHUB_ENV
echo "CI_EVAL_IOS_APP_STORE_KEY_FILE=`pwd`/api_key.p8" >> $GITHUB_ENV
- name: Deploy to TestFlight
env:
CI_EVALUATION_APP_STORE_API_KEY_ID: ${{ secrets.CI_EVALUATION_APP_STORE_API_KEY_ID }}
CI_EVALUATION_APP_STORE_API_KEY_ISSUER_ID: ${{ secrets.CI_EVALUATION_APP_STORE_API_KEY_ISSUER_ID }}
CI_EVALUATION_CERTIFICATE_PASSWORD: ${{ secrets.CI_EVALUATION_CERTIFICATE_PASSWORD }}
CI_EVALUATION_APP_IDENTIFIER: ${{ secrets.CI_EVALUATION_APP_IDENTIFIER }}
CI_EVAL_IOS_CERT_PASSWORD: ${{ secrets.CI_EVAL_IOS_CERT_PASSWORD }}
CI_EVAL_IOS_APP_STORE_KEY_ID: ${{ secrets.CI_EVAL_IOS_APP_STORE_KEY_ID }}
CI_EVAL_IOS_APP_STORE_KEY_ISSUER_ID: ${{ secrets.CI_EVAL_IOS_APP_STORE_KEY_ISSUER_ID }}
CI_EVAL_PROD_APP_IDENTIFIER: ${{ secrets.CI_EVAL_PROD_APP_IDENTIFIER }}
working-directory: ./ios
run: bundle exec fastlane deployToTestFlight

View file

@ -12,7 +12,7 @@ jobs:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
@ -27,6 +27,7 @@ jobs:
restore-keys: ${{ runner.os }}-npm-
- name: Install Dependencies
run: npm ci
- name: Run Tests
run: npm run test
@ -37,7 +38,7 @@ jobs:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
@ -54,24 +55,20 @@ jobs:
run: npm ci
- name: Set up Ruby & Fastlane
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.1'
bundler-cache: true
working-directory: ./android
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
# caching currently disabled, because the files are large, but don't decrease built time too much
#cache: gradle
- name: Restore Release Keystore
env:
keystore_base64: ${{ secrets.RELEASE_KEYSTORE_BASE64 }}
run: |
echo "$keystore_base64" | base64 --decode > release.keystore
echo "CI_EVALUATION_KEYSTORE_FILE=`pwd`/release.keystore" >> $GITHUB_ENV
- name: Build Release APK
env:
CI_EVALUATION_KEY_ALIAS: ${{ secrets.CI_EVALUATION_KEY_ALIAS }}
CI_EVALUATION_KEY_PASSWORD: ${{ secrets.CI_EVALUATION_KEY_PASSWORD }}
CI_EVALUATION_STORE_PASSWORD: ${{ secrets.CI_EVALUATION_STORE_PASSWORD }}
- name: Build APK
working-directory: ./android
run: bundle exec fastlane buildReleaseApk
@ -82,7 +79,7 @@ jobs:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
@ -99,12 +96,11 @@ jobs:
run: npm ci
- name: Set up Ruby & Fastlane
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.1'
bundler-cache: true
working-directory: ./ios
- name: pod install cache
uses: actions/cache@v3
id: pod-cache
@ -116,24 +112,23 @@ jobs:
working-directory: ./ios
run: pod install
- name: Restore Provisioning Profile
- name: Restore Internal Provisioning Profile
env:
ci_evaluation_provision_profile_base64: ${{ secrets.CI_EVALUATION_PROVISION_PROFILE_BASE64 }}
provision_profile_base64: ${{ secrets.CI_EVAL_IOS_PROVISIONING_PROFILE_INTERNAL_BASE64 }}
run: |
echo "$ci_evaluation_provision_profile_base64" | base64 --decode > profile.mobileprovision
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp profile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/profile.mobileprovision
echo "CI_EVALUATION_PROVISIONING_PROFILE_FILE=\"~/Library/MobileDevice/Provisioning Profiles/profile.mobileprovision\"" >> $GITHUB_ENV
echo "$provision_profile_base64" | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/internal_profile.mobileprovision
echo "CI_EVAL_IOS_PROVISIONING_PROFILE_INTERNAL_FILENAME=internal_profile.mobileprovision" >> $GITHUB_ENV
- name: Restore iOS Cert
env:
ci_evaluation_cert_base64: ${{ secrets.CI_EVALUATION_CERT_BASE64 }}
ios_cert_base64: ${{ secrets.CI_EVAL_IOS_CERT_BASE64 }}
run: |
echo "$ci_evaluation_cert_base64" | base64 --decode > ios_distribution.p12
echo "CI_EVALUATION_IOS_CERT_FILE=`pwd`/ios_distribution.p12" >> $GITHUB_ENV
echo "$ios_cert_base64" | base64 --decode > ios_distribution.p12
echo "CI_EVAL_IOS_CERT_FILE=`pwd`/ios_distribution.p12" >> $GITHUB_ENV
- name: Build Release IPA
env:
CI_EVALUATION_CERTIFICATE_PASSWORD: ${{ secrets.CI_EVALUATION_CERTIFICATE_PASSWORD }}
CI_EVALUATION_APP_IDENTIFIER: ${{ secrets.CI_EVALUATION_APP_IDENTIFIER }}
CI_EVAL_IOS_CERT_PASSWORD: ${{ secrets.CI_EVAL_IOS_CERT_PASSWORD }}
CI_EVAL_INTERNAL_APP_IDENTIFIER: ${{ secrets.CI_EVAL_INTERNAL_APP_IDENTIFIER }}
working-directory: ./ios
run: bundle exec fastlane buildReleaseIPA

View file

@ -73,6 +73,7 @@ def jscFlavor = 'org.webkit:android-jsc:+'
// custom properties
def applicationIdArgument = project.findProperty('applicationId')
def applicationVersionCodeArgument = project.findProperty('versionCode')?.toInteger()
def useDebugSigningForReleaseBuild = project.findProperty('useDebugSigningForReleaseBuild')?.toBoolean() ?: false
android {
ndkVersion rootProject.ext.ndkVersion
@ -95,10 +96,10 @@ android {
keyPassword 'android'
}
release {
storeFile file(System.getenv("CI_EVALUATION_KEYSTORE_FILE") ?: 'debug.keystore')
keyAlias System.getenv("CI_EVALUATION_KEY_ALIAS") ?: ''
keyPassword System.getenv("CI_EVALUATION_KEY_PASSWORD") ?: ''
storePassword System.getenv("CI_EVALUATION_STORE_PASSWORD") ?: ''
storeFile file(System.getenv("CI_EVAL_ANDROID_KEYSTORE_FILE") ?: 'debug.keystore')
keyAlias System.getenv("CI_EVAL_ANDROID_KEYSTORE_KEY_ALIAS") ?: ''
keyPassword System.getenv("CI_EVAL_ANDROID_KEYSTORE_KEY_PASSWORD") ?: ''
storePassword System.getenv("CI_EVAL_ANDROID_KEYSTORE_STORE_PASSWORD") ?: ''
}
}
buildTypes {
@ -108,7 +109,11 @@ android {
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
if (useDebugSigningForReleaseBuild) {
signingConfig signingConfigs.debug
} else {
signingConfig signingConfigs.release
}
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}

View file

@ -18,22 +18,24 @@ default_platform(:android)
platform :android 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's testing group
FIREBASE_DISTRIBUTION_INTERNAL_APP = "1:64659984801:android:7a0514333a32b8c5f43be0"
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']
# Environment variable, service account key to authenticate with PlayStore
PLAYSTORE_SERVICE_ACCOUNT_FILE = ENV['CI_EVALUATION_PLAYSTORE_SERVICE_ACCOUNT_FILE']
INTERNAL_APP_IDENTIFIER = "com.initproject.staging"
PROD_APP_IDENTIFIER = "com.initproject.prod"
# Environment variable should be the full path to the firebase auth .json
FIREBASE_DISTRIBUTION_AUTH_FILE = ENV['CI_EVAL_FIREBASE_DISTRIBUTION_AUTH_FILE']
# Environment variable should be the full path to the PlayStore auth .json
PLAY_STORE_AUTH_FILE = ENV['CI_EVAL_ANDROID_PLAY_STORE_AUTH_FILE']
end
desc "Submit a new Internal Build to Firebase"
desc ">Optionally release notes can be added like so:"
desc "```sh"
desc "[bundle exec] fastlane deployInternalFirebase release_notes:\"testing notes\""
desc "[bundle exec] fastlane deployInternalToFirebase release_notes:\"testing notes\""
desc "```"
lane :deployInternalFirebase do |options|
lane :deployInternalToFirebase do |options|
release_notes = options[:release_notes]
if release_notes.nil?
commit = last_git_commit
@ -44,8 +46,8 @@ platform :android do
internal_apk = lane_context[SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS].find{ |i| i[/app-*release*.apk/] }
firebase_app_distribution(
service_credentials_file: FIREBASE_SERVICE_ACCOUNT_FILE,
app: FIREBASE_APP_DISTRIBUTION_APP_STAGING,
service_credentials_file: FIREBASE_DISTRIBUTION_AUTH_FILE,
app: FIREBASE_DISTRIBUTION_INTERNAL_APP,
groups: FIREBASE_APP_DISTRIBUTION_GROUPS_QA,
android_artifact_type: 'APK',
android_artifact_path: internal_apk,
@ -62,7 +64,8 @@ platform :android do
build_type: 'release',
flags: "--no-daemon",
properties: {
"applicationId" => "com.initproject.staging"
"applicationId" => INTERNAL_APP_IDENTIFIER,
"useDebugSigningForReleaseBuild" => "true"
}
)
end
@ -71,16 +74,16 @@ platform :android do
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 "[bundle exec] fastlane deployProdToPlayStore skip_build_number_increase:1"
desc "```"
lane :deployProdPlayStore do |options|
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"
lane :deployProdToPlayStore do |options|
skip_build_number_increase = options[:skip_build_number_increase] # optional, if not set, it gets the last from PlayStore then adds + 1
package_name = PROD_APP_IDENTIFIER
if skip_build_number_increase.nil?
last_version_codes = google_play_track_version_codes(
track: 'internal',
json_key: PLAYSTORE_SERVICE_ACCOUNT_FILE,
json_key: PLAY_STORE_AUTH_FILE,
package_name: package_name
)
last_version_code = last_version_codes[0]
@ -93,6 +96,7 @@ platform :android do
build_type: 'release',
flags: "--no-daemon",
properties: {
"applicationId" => PROD_APP_IDENTIFIER,
"versionCode" => version_code
}
)
@ -102,7 +106,7 @@ platform :android do
track: 'internal',
release_status: 'draft', # can remove once app is released to the public
aab: production_aab,
json_key: PLAYSTORE_SERVICE_ACCOUNT_FILE,
json_key: PLAY_STORE_AUTH_FILE,
skip_upload_apk: true,
package_name: package_name,
)

View file

@ -18,38 +18,41 @@ default_platform(:ios)
platform :ios 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's testing group
FIREBASE_DISTRIBUTION_INTERNAL_APP = "1:64659984801:ios:a9c4640d2a1960a5f43be0"
FIREBASE_APP_DISTRIBUTION_GROUPS_QA = "ios-qa"
# name of the keychain created while signing
KEYCHAIN_NAME = "temp_keychain"
INTERNAL_APP_IDENTIFIER = ENV['CI_EVAL_INTERNAL_APP_IDENTIFIER']
PROD_APP_IDENTIFIER = ENV['CI_EVAL_PROD_APP_IDENTIFIER']
APP_TARGET = "InitProject"
# Environment variable should be the full path to the firebase auth .json
FIREBASE_DISTRIBUTION_AUTH_FILE = ENV['CI_EVAL_FIREBASE_DISTRIBUTION_AUTH_FILE']
# provisioning profiles, they are under a specific folder
# filename come from environment variable
provisioning_profile_folder = "#{ENV['HOME']}/Library/MobileDevice/Provisioning Profiles"
internal_provisioning_profile_name = ENV['CI_EVAL_IOS_PROVISIONING_PROFILE_INTERNAL_FILENAME']
INTERNAL_PROVISIONING_PROFILE_FILE = "#{provisioning_profile_folder}/#{internal_provisioning_profile_name}"
prod_provisioning_profile_name = ENV['CI_EVAL_IOS_PROVISIONING_PROFILE_PROD_FILENAME']
PROD_PROVISIONING_PROFILE_FILE = "#{provisioning_profile_folder}/#{prod_provisioning_profile_name}"
# Environment variable, service account key to authenticate with firebase
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_EVAL_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 Api Key File, created on the Apple Developer portal
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 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']
CERTIFICATE_PASSWORD = ENV['CI_EVAL_IOS_CERT_PASSWORD'].strip
# App Api Key File Path, created on https://appstoreconnect.apple.com/access/api
APP_STORE_API_KEY_FILE = ENV['CI_EVAL_IOS_APP_STORE_KEY_FILE']
APP_STORE_API_KEY_ID = ENV['CI_EVAL_IOS_APP_STORE_KEY_ID']
APP_STORE_API_KEY_ISSUER_ID = ENV['CI_EVAL_IOS_APP_STORE_KEY_ISSUER_ID']
end
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 "[bundle exec] fastlane deployInternalToFirebase release_notes:\"testing notes\""
desc "```"
lane :deployInternalFirebase do |options|
lane :deployInternalToFirebase do |options|
release_notes = options[:release_notes]
if release_notes.nil?
commit = last_git_commit
@ -57,16 +60,20 @@ platform :ios do
end
ipa_name = "Internal.ipa"
buildReleaseIPA(ipa_name: ipa_name, method: "ad-hoc")
buildReleaseIPA(
ipa_name: ipa_name,
method: "ad-hoc",
profile: INTERNAL_PROVISIONING_PROFILE_FILE,
app_identifier: INTERNAL_APP_IDENTIFIER,
)
firebase_app_distribution(
service_credentials_file: FIREBASE_SERVICE_ACCOUNT_FILE,
app: FIREBASE_APP_DISTRIBUTION_APP_STAGING,
service_credentials_file: FIREBASE_DISTRIBUTION_AUTH_FILE,
app: FIREBASE_DISTRIBUTION_INTERNAL_APP,
groups: FIREBASE_APP_DISTRIBUTION_GROUPS_QA,
ipa_path: "builds/#{ipa_name}",
release_notes: "#{release_notes}",
)
cleanupKeyChain()
end
desc "Submit a new Production Build to TestFlight"
@ -87,37 +94,39 @@ platform :ios do
if skip_build_number_increase.nil?
increment_build_number({
build_number: latest_testflight_build_number(app_identifier: APP_IDENTIFIER) + 1
build_number: latest_testflight_build_number(app_identifier: PROD_APP_IDENTIFIER) + 1
})
end
setupCodeSigning()
ipa_name = "Release.ipa"
buildReleaseIPA(ipa_name: ipa_name, method: "app-store")
buildReleaseIPA(
ipa_name: ipa_name,
method: "app-store",
profile: PROD_PROVISIONING_PROFILE_FILE,
app_identifier: PROD_APP_IDENTIFIER,
)
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|
ipa_name = options[:ipa_name]
method = options[:method]
if ipa_name.nil?
ipa_name = "InternalBuild.ipa"
end
if method.nil?
method = "ad-hoc"
end
setupCodeSigning()
ipa_name = options[:ipa_name] || "InternalBuild.ipa"
method = options[:method] || "ad-hoc"
profile = options[:profile] || INTERNAL_PROVISIONING_PROFILE_FILE
app_identifier = options[:app_identifier] || INTERNAL_APP_IDENTIFIER
setupCodeSigning(
profile: profile,
app_identifier: app_identifier,
)
build_app(
scheme: "InitProject",
scheme: APP_TARGET,
export_method: method,
output_directory: "./builds",
output_name: ipa_name
@ -126,7 +135,9 @@ platform :ios do
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 |options|
profile = options[:profile]
app_identifier = options[:app_identifier]
password = (0...50).map { ('a'..'z').to_a[rand(26)] }.join
cleanupKeyChain()
create_keychain(
@ -138,6 +149,7 @@ platform :ios do
add_to_search_list: true,
password: password
)
import_certificate(
certificate_path: IOS_CERT_FILE,
keychain_name: KEYCHAIN_NAME,
@ -146,18 +158,25 @@ platform :ios do
log_output: true
)
update_app_identifier(
plist_path: "InitProject/Info.plist",
app_identifier: APP_IDENTIFIER
plist_path: "#{APP_TARGET}/Info.plist",
app_identifier: app_identifier
)
update_project_provisioning(
xcodeproj: "InitProject.xcodeproj",
target_filter: "InitProject",
profile: PROVISIONING_PROFILE_FILE,
xcodeproj: "#{APP_TARGET}.xcodeproj",
target_filter: "#{APP_TARGET}",
profile: profile,
build_configuration: "Release"
)
update_project_team( # Set the right team on your project
teamid: CredentialsManager::AppfileConfig.try_fetch_value(:team_id)
)
update_code_signing_settings(
use_automatic_signing: false,
code_sign_identity: "iPhone Distribution",
path: "#{APP_TARGET}.xcodeproj",
sdk: "iphoneos*"
)
unlock_keychain(
path: KEYCHAIN_NAME,
password: password