This commit is contained in:
Gergely Hegedus 2023-09-05 12:24:55 +03:00
parent cc2b65c3ae
commit 78c780b3b6
8 changed files with 249 additions and 27 deletions

View file

@ -4,19 +4,67 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
android-publish-to-firebase: # android-publish-to-firebase:
runs-on: ubuntu-latest # runs-on: ubuntu-latest
# permissions:
# contents: read
# 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: 16
# cache: 'npm'
# - name: Set up Ruby
# uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
# with:
# ruby-version: '3.2.1'
# - name: Setup Fastlane
# working-directory: ./android
# run: bundle install
# - 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') }}
# - 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: Restore Firebase Service Account
# env:
# firebase_service_account_base64: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_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: 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
ios-publish-to-firebase:
runs-on: macos-latest
permissions: permissions:
contents: read contents: read
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
cache: gradle
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
@ -27,7 +75,7 @@ jobs:
with: with:
ruby-version: '3.2.1' ruby-version: '3.2.1'
- name: Setup Fastlane - name: Setup Fastlane
working-directory: ./android working-directory: ./ios
run: bundle install run: bundle install
- name: node_modules cache - name: node_modules cache
uses: actions/cache@v3 uses: actions/cache@v3
@ -38,22 +86,39 @@ jobs:
restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
- name: Install Dependencies - name: Install Dependencies
run: npm ci run: npm ci
- name: Restore Release Keystore - name: pod install cache
env: uses: actions/cache@v3
keystore_base64: ${{ secrets.RELEASE_KEYSTORE_BASE64 }} id: pod-cache
run: | with:
echo "$keystore_base64" | base64 --decode > release.keystore path: ios/Pods
echo "CI_EVALUATION_KEYSTORE_FILE=`pwd`/release.keystore" >> $GITHUB_ENV key: ${{ runner.os }}-pod-${{ hashFiles('ios/Podfile.lock') }}
restore-keys: ${{ runner.os }}-pod-${{ hashFiles('ios/Podfile.lock') }}
- name: Install iOS Dependencies
working-directory: ./ios
run: pod install
- name: Restore Firebase Service Account - name: Restore Firebase Service Account
env: env:
firebase_service_account_base64: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_BASE64 }} firebase_service_account_base64: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_BASE64 }}
run: | run: |
echo "$firebase_service_account_base64" | base64 --decode > firebase-distribution-service-account.json 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_EVALUATION_FIREBASE_SERVICE_ACCOUNT_FILE=`pwd`/firebase-distribution-service-account.json" >> $GITHUB_ENV
- name: Restore Provisioning Profile
env:
ci_evaluation_provision_profile_base64: ${{ secrets.CI_EVALUATION_PROVISION_PROFILE_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
- name: Restore iOS Cert
env:
ci_evaluation_cert_base64: ${{ secrets.CI_EVALUATION_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
- name: Deploy to Firebase - name: Deploy to Firebase
env: env:
CI_EVALUATION_KEY_ALIAS: ${{ secrets.CI_EVALUATION_KEY_ALIAS }} CI_EVALUATION_CERTIFICATE_PASSWORD: ${{ secrets.CI_EVALUATION_CERTIFICATE_PASSWORD }}
CI_EVALUATION_KEY_PASSWORD: ${{ secrets.CI_EVALUATION_KEY_PASSWORD }} CI_EVALUATION_APP_IDENTIFIER: ${{ secrets.CI_EVALUATION_APP_IDENTIFIER }}
CI_EVALUATION_STORE_PASSWORD: ${{ secrets.CI_EVALUATION_STORE_PASSWORD }} working-directory: ./ios
working-directory: ./android run: bundle exec fastlane deployInternalFirebase
run: bundle exec fastlane deployInternalFirebase

View file

@ -1,3 +1,6 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "fastlane" gem "fastlane"
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)

View file

@ -105,6 +105,8 @@ GEM
xcodeproj (>= 1.13.0, < 2.0.0) xcodeproj (>= 1.13.0, < 2.0.0)
xcpretty (~> 0.3.0) xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3) xcpretty-travis-formatter (>= 0.0.3)
fastlane-plugin-firebase_app_distribution (0.7.2)
google-apis-firebaseappdistribution_v1 (~> 0.3.0)
gh_inspector (1.1.3) gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.49.0) google-apis-androidpublisher_v3 (0.49.0)
google-apis-core (>= 0.11.0, < 2.a) google-apis-core (>= 0.11.0, < 2.a)
@ -117,6 +119,8 @@ GEM
retriable (>= 2.0, < 4.a) retriable (>= 2.0, < 4.a)
rexml rexml
webrick webrick
google-apis-firebaseappdistribution_v1 (0.3.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-iamcredentials_v1 (0.17.0) google-apis-iamcredentials_v1 (0.17.0)
google-apis-core (>= 0.11.0, < 2.a) google-apis-core (>= 0.11.0, < 2.a)
google-apis-playcustomapp_v1 (0.13.0) google-apis-playcustomapp_v1 (0.13.0)
@ -213,6 +217,7 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
fastlane fastlane
fastlane-plugin-firebase_app_distribution
BUNDLED WITH BUNDLED WITH
2.4.10 2.4.10

View file

@ -433,6 +433,7 @@
baseConfigurationReference = 5B7EB9410499542E8C5724F5 /* Pods-InitProject-InitProjectTests.debug.xcconfig */; baseConfigurationReference = 5B7EB9410499542E8C5724F5 /* Pods-InitProject-InitProjectTests.debug.xcconfig */;
buildSettings = { buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)"; BUNDLE_LOADER = "$(TEST_HOST)";
DEVELOPMENT_TEAM = Y6P2NYW2G8;
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1", "DEBUG=1",
"$(inherited)", "$(inherited)",
@ -461,6 +462,7 @@
buildSettings = { buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)"; BUNDLE_LOADER = "$(TEST_HOST)";
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
DEVELOPMENT_TEAM = Y6P2NYW2G8;
INFOPLIST_FILE = InitProjectTests/Info.plist; INFOPLIST_FILE = InitProjectTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.4; IPHONEOS_DEPLOYMENT_TARGET = 12.4;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
@ -475,6 +477,8 @@
); );
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "6f52a894-60c1-4aff-9863-e6f5c719c29e";
PROVISIONING_PROFILE_SPECIFIER = "CI Test Draft App Profile";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/InitProject.app/InitProject"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/InitProject.app/InitProject";
}; };
name = Release; name = Release;
@ -485,7 +489,10 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = Y6P2NYW2G8;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = Y6P2NYW2G8;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = InitProject/Info.plist; INFOPLIST_FILE = InitProject/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
@ -498,8 +505,10 @@
"-ObjC", "-ObjC",
"-lc++", "-lc++",
); );
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = test;
PRODUCT_NAME = InitProject; PRODUCT_NAME = InitProject;
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Gergely Hegedus Development Profile";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
@ -512,7 +521,12 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = Y6P2NYW2G8;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = Y6P2NYW2G8;
INFOPLIST_FILE = InitProject/Info.plist; INFOPLIST_FILE = InitProject/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
@ -524,8 +538,11 @@
"-ObjC", "-ObjC",
"-lc++", "-lc++",
); );
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = test;
PRODUCT_NAME = InitProject; PRODUCT_NAME = InitProject;
PROVISIONING_PROFILE = "6f52a894-60c1-4aff-9863-e6f5c719c29e";
PROVISIONING_PROFILE_SPECIFIER = "CI Test Draft App Profile";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "CI Test Draft App Profile";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };

View file

@ -1,6 +1,6 @@
# app_identifier("[[APP_IDENTIFIER]]") # The bundle identifier of your app # app_identifier("[[APP_IDENTIFIER]]") # The bundle identifier of your app
# apple_id("[[APPLE_ID]]") # Your Apple Developer Portal username # apple_id("[[APPLE_ID]]") # Your Apple Developer Portal username
team_id("Y6P2NYW2G8")
# For more information about the Appfile, see: # For more information about the Appfile, see:
# https://docs.fastlane.tools/advanced/#appfile # https://docs.fastlane.tools/advanced/#appfile

View file

@ -16,8 +16,87 @@
default_platform(:ios) default_platform(:ios)
platform :ios do platform :ios do
desc "Description of what the lane does"
lane :custom_lane do before_all do
# add actions here: https://docs.fastlane.tools/actions FIREBASE_APP_DISTRIBUTION_APP_STAGING = "1:64659984801:ios:a9c4640d2a1960a5f43be0"
FIREBASE_APP_DISTRIBUTION_GROUPS_QA = "ios-qa"
FIREBASE_SERVICE_ACCOUNT_FILE = ENV['CI_EVALUATION_FIREBASE_SERVICE_ACCOUNT_FILE']
KEYCHAIN_NAME = "temp_keychain"
PROVISIONING_PROFILE_FILE = ENV['CI_EVALUATION_PROVISIONING_PROFILE_FILE']
CERTIFICATE_PASSWORD = ENV['CI_EVALUATION_CERTIFICATE_PASSWORD'].strip
PROVISIONING_PROFILE_FILE = "#{ENV['HOME']}/Library/MobileDevice/Provisioning Profiles/profile.mobileprovision"
IOS_CERT_FILE = ENV['CI_EVALUATION_IOS_CERT_FILE']
APP_IDENTIFIER = ENV['CI_EVALUATION_APP_IDENTIFIER']
end end
end
lane :setupCodeSigning do
password = (0...50).map { ('a'..'z').to_a[rand(26)] }.join
cleanupKeyChain()
create_keychain(
name: KEYCHAIN_NAME,
default_keychain: false,
unlock: true,
timeout: 360000,
lock_when_sleeps: false,
add_to_search_list: true,
password: password
)
import_certificate(
certificate_path: IOS_CERT_FILE,
keychain_name: KEYCHAIN_NAME,
keychain_password: password,
certificate_password: CERTIFICATE_PASSWORD,
log_output: true
)
update_app_identifier(
plist_path: "InitProject/Info.plist",
app_identifier: APP_IDENTIFIER
)
update_project_provisioning(
xcodeproj: "InitProject.xcodeproj",
target_filter: "InitProject",
profile: PROVISIONING_PROFILE_FILE,
build_configuration: "Release"
)
update_project_team( # Set the right team on your project
teamid: CredentialsManager::AppfileConfig.try_fetch_value(:team_id)
)
unlock_keychain(
path: KEYCHAIN_NAME,
password: password
)
end
desc "Description of what the lane does"
lane :deployInternalFirebase do
setupCodeSigning()
ipa_name = "Internal.ipa"
build_app(
scheme: "InitProject",
export_method: "ad-hoc",
output_directory: "./builds",
output_name: ipa_name
)
firebase_app_distribution(
service_credentials_file: FIREBASE_SERVICE_ACCOUNT_FILE,
app: FIREBASE_APP_DISTRIBUTION_APP_STAGING,
groups: FIREBASE_APP_DISTRIBUTION_GROUPS_QA,
ipa_path: "builds/#{ipa_name}",
)
cleanupKeyChain()
end
lane :cleanupKeyChain do
begin
delete_keychain(name: KEYCHAIN_NAME) if File.exist? File.expand_path("/Users/runner/Library/Keychains/#{KEYCHAIN_NAME}-db")
rescue => ex
UI.important('Could not delete keychain!')
end
end
after_all do
cleanupKeyChain()
end
end

5
ios/fastlane/Pluginfile Normal file
View file

@ -0,0 +1,5 @@
# Autogenerated by fastlane
#
# Ensure this file is checked in to source control!
gem 'fastlane-plugin-firebase_app_distribution'

48
ios/fastlane/README.md Normal file
View file

@ -0,0 +1,48 @@
fastlane documentation
----
# Installation
Make sure you have the latest version of the Xcode command line tools installed:
```sh
xcode-select --install
```
For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane)
# Available Actions
## iOS
### ios setupCodeSigning
```sh
[bundle exec] fastlane ios setupCodeSigning
```
### ios deployInternalFirebase
```sh
[bundle exec] fastlane ios deployInternalFirebase
```
Description of what the lane does
### ios cleanupKeyChain
```sh
[bundle exec] fastlane ios cleanupKeyChain
```
----
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).