From 1d69522c2623db160cb851b03d16b0f79e9801de Mon Sep 17 00:00:00 2001 From: Gergely Hegedus Date: Thu, 7 Sep 2023 17:57:51 +0300 Subject: [PATCH] testflight job --- .github/workflows/deploy_to_playstore.yml | 59 --------- .../deploy_to_playstore_testflight.yml | 125 ++++++++++++++++++ ios/InitProject.xcodeproj/project.pbxproj | 13 +- ios/fastlane/Fastfile | 33 ++++- ios/fastlane/README.md | 8 ++ 5 files changed, 170 insertions(+), 68 deletions(-) delete mode 100644 .github/workflows/deploy_to_playstore.yml create mode 100644 .github/workflows/deploy_to_playstore_testflight.yml diff --git a/.github/workflows/deploy_to_playstore.yml b/.github/workflows/deploy_to_playstore.yml deleted file mode 100644 index 836022e..0000000 --- a/.github/workflows/deploy_to_playstore.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Deploy to Play Store Internal Track - -on: - workflow_dispatch: - -jobs: - android-publish-to-play-store: - 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 PlayStore Service Account - env: - play_store_service_account_base64: ${{ secrets.PLAY_STORE_SERVICE_ACCOUNT_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 - - 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 }} - working-directory: ./android - run: bundle exec fastlane deployProdPlayStore diff --git a/.github/workflows/deploy_to_playstore_testflight.yml b/.github/workflows/deploy_to_playstore_testflight.yml new file mode 100644 index 0000000..32da8c6 --- /dev/null +++ b/.github/workflows/deploy_to_playstore_testflight.yml @@ -0,0 +1,125 @@ +name: Deploy to Play Store Internal Track + +on: + workflow_dispatch: + +jobs: + android-publish-to-play-store: + 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 PlayStore Service Account + env: + play_store_service_account_base64: ${{ secrets.PLAY_STORE_SERVICE_ACCOUNT_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 + - 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 }} + working-directory: ./android + run: bundle exec fastlane deployProdPlayStore + + ios-publish-to-testflight: + runs-on: macos-latest + permissions: + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 16 + 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 + with: + path: node_modules + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-npm- + - name: Install Dependencies + run: npm ci + - name: pod install cache + uses: actions/cache@v3 + id: pod-cache + with: + path: ios/Pods + key: ${{ runner.os }}-pod-${{ hashFiles('ios/Podfile.lock') }} + restore-keys: ${{ runner.os }}-pod- + - name: Install iOS Dependencies + working-directory: ./ios + run: pod install + - name: Restore Provisioning Profile + env: + ci_evaluation_provision_profile_base64: ${{ secrets.CI_EVALUATION_APPSTORE_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: Restore App Store API Key + env: + app_store_api_key_base64: ${{ secrets.APP_STORE_API_KEY_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 + - 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 }} + working-directory: ./ios + run: bundle exec fastlane deployToTestFlight diff --git a/ios/InitProject.xcodeproj/project.pbxproj b/ios/InitProject.xcodeproj/project.pbxproj index d90877e..543ff06 100644 --- a/ios/InitProject.xcodeproj/project.pbxproj +++ b/ios/InitProject.xcodeproj/project.pbxproj @@ -477,8 +477,8 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = "6f52a894-60c1-4aff-9863-e6f5c719c29e"; - PROVISIONING_PROFILE_SPECIFIER = "CI Test Draft App Profile"; + PROVISIONING_PROFILE = "71003876-1981-4670-a50e-64faa92d981c"; + PROVISIONING_PROFILE_SPECIFIER = "CI Test Draft App Profile (appstore)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/InitProject.app/InitProject"; }; name = Release; @@ -505,7 +505,7 @@ "-ObjC", "-lc++", ); - PRODUCT_BUNDLE_IDENTIFIER = test; + PRODUCT_BUNDLE_IDENTIFIER = com.halcyonmobile.internal.citest; PRODUCT_NAME = InitProject; PROVISIONING_PROFILE_SPECIFIER = ""; "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Gergely Hegedus Development Profile"; @@ -538,11 +538,10 @@ "-ObjC", "-lc++", ); - PRODUCT_BUNDLE_IDENTIFIER = test; + PRODUCT_BUNDLE_IDENTIFIER = com.halcyonmobile.internal.citest; 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"; + PROVISIONING_PROFILE = "71003876-1981-4670-a50e-64faa92d981c"; + PROVISIONING_PROFILE_SPECIFIER = "CI Test Draft App Profile (appstore)"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index 09ef994..7f204f3 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -27,12 +27,15 @@ platform :ios do 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'] + APP_STORE_API_KEY_FILE = ENV['CI_EVALUATION_APP_STORE_API_KEY_FILE'] + APP_STORE_API_KEY_ID = ENV['CI_EVALUATION_APP_STORE_API_KEY_ID'] + APP_STORE_API_KEY_ISSUER_ID = ENV['CI_EVALUATION_APP_STORE_API_KEY_ISSUER_ID'] end desc "Description of what the lane does" lane :deployInternalFirebase do ipa_name = "Internal.ipa" - buildReleaseIPA(ipa_name: ipa_name) + buildReleaseIPA(ipa_name: ipa_name, method: "ad-hoc") firebase_app_distribution( service_credentials_file: FIREBASE_SERVICE_ACCOUNT_FILE, @@ -43,16 +46,42 @@ platform :ios do cleanupKeyChain() end + desc "Description of what the lane does" + lane :deployToTestFlight do + setupCodeSigning() + ipa_name = "Release.ipa" + buildReleaseIPA(ipa_name: ipa_name, method: "app-store") + + 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 + ) + + upload_to_testflight( + skip_submission: true, + ipa: "./builds/#{ipa_name}", + skip_waiting_for_build_processing: true, + ) + cleanupKeyChain() + end + 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() build_app( scheme: "InitProject", - export_method: "ad-hoc", + export_method: method, output_directory: "./builds", output_name: ipa_name ) diff --git a/ios/fastlane/README.md b/ios/fastlane/README.md index 46ae987..a51aa3a 100644 --- a/ios/fastlane/README.md +++ b/ios/fastlane/README.md @@ -23,6 +23,14 @@ For _fastlane_ installation instructions, see [Installing _fastlane_](https://do Description of what the lane does +### ios deployToTestFlight + +```sh +[bundle exec] fastlane ios deployToTestFlight +``` + +Description of what the lane does + ### ios buildReleaseIPA ```sh