From c474f72f91959e542e35bb2b596bbd448888d45b Mon Sep 17 00:00:00 2001 From: Su Nguyen T Date: Tue, 31 Jan 2023 11:47:49 +0700 Subject: [PATCH 1/6] Revert "[Chore] [#423] Update a specific name for deploying staging build to firebase workflow" --- .../{deploy_staging_firebase.yml => deploy_Firebase.yml} | 2 +- ...ploy_production_firebase.yml => deploy_Release_Firebase.yml} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{deploy_staging_firebase.yml => deploy_Firebase.yml} (98%) rename .github/workflows/{deploy_production_firebase.yml => deploy_Release_Firebase.yml} (98%) diff --git a/.github/workflows/deploy_staging_firebase.yml b/.github/workflows/deploy_Firebase.yml similarity index 98% rename from .github/workflows/deploy_staging_firebase.yml rename to .github/workflows/deploy_Firebase.yml index d5ac0b71..70f8d6a2 100644 --- a/.github/workflows/deploy_staging_firebase.yml +++ b/.github/workflows/deploy_Firebase.yml @@ -1,4 +1,4 @@ -name: Deploy Staging Build To Firebase +name: Deploy Build To Firebase # SECRETS needed: ### SSH_PRIVATE_KEY for Match Repo diff --git a/.github/workflows/deploy_production_firebase.yml b/.github/workflows/deploy_Release_Firebase.yml similarity index 98% rename from .github/workflows/deploy_production_firebase.yml rename to .github/workflows/deploy_Release_Firebase.yml index 2b9209c9..0e5798d3 100644 --- a/.github/workflows/deploy_production_firebase.yml +++ b/.github/workflows/deploy_Release_Firebase.yml @@ -1,4 +1,4 @@ -name: Deploy Production Build To Firebase +name: Deploy Release Build To Firebase # SECRETS needed: ### SSH_PRIVATE_KEY for Match Repo From 123118fa97e1a3cbe7c5db5a313ee80d3c844522 Mon Sep 17 00:00:00 2001 From: nkhanh44 Date: Wed, 11 Jan 2023 14:39:19 +0700 Subject: [PATCH 2/6] [#423] Update names for workflows and their descriptions --- ...ploy_Release_Firebase.yml => deploy_production_firebase.yml} | 2 +- .../{deploy_Firebase.yml => deploy_staging_firebase.yml} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{deploy_Release_Firebase.yml => deploy_production_firebase.yml} (98%) rename .github/workflows/{deploy_Firebase.yml => deploy_staging_firebase.yml} (98%) diff --git a/.github/workflows/deploy_Release_Firebase.yml b/.github/workflows/deploy_production_firebase.yml similarity index 98% rename from .github/workflows/deploy_Release_Firebase.yml rename to .github/workflows/deploy_production_firebase.yml index 0e5798d3..2b9209c9 100644 --- a/.github/workflows/deploy_Release_Firebase.yml +++ b/.github/workflows/deploy_production_firebase.yml @@ -1,4 +1,4 @@ -name: Deploy Release Build To Firebase +name: Deploy Production Build To Firebase # SECRETS needed: ### SSH_PRIVATE_KEY for Match Repo diff --git a/.github/workflows/deploy_Firebase.yml b/.github/workflows/deploy_staging_firebase.yml similarity index 98% rename from .github/workflows/deploy_Firebase.yml rename to .github/workflows/deploy_staging_firebase.yml index 70f8d6a2..d5ac0b71 100644 --- a/.github/workflows/deploy_Firebase.yml +++ b/.github/workflows/deploy_staging_firebase.yml @@ -1,4 +1,4 @@ -name: Deploy Build To Firebase +name: Deploy Staging Build To Firebase # SECRETS needed: ### SSH_PRIVATE_KEY for Match Repo From fa4a6812f7693fb84f424badcb84d6fa9170a875 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 22 Aug 2023 09:35:22 +0700 Subject: [PATCH 3/6] [#510] Add function remove in Keychain to remove keychain in case the runner is self-hosted Add new fastlane lane removeKeychain Add remove keychain step in github action workflow Add continue-on-error: true for step remove keychain --- .github/workflows/deploy_app_store.yml | 5 +++++ .github/workflows/deploy_production_firebase.yml | 5 +++++ .github/workflows/deploy_staging_firebase.yml | 5 +++++ .github/workflows/test_upload_build_to_firebase.yml | 5 +++++ .../workflows/test_upload_build_to_test_flight.yml | 5 +++++ fastlane/Constants/Constant.swift | 1 + fastlane/Fastfile.swift | 5 +++++ fastlane/Helpers/Keychain.swift | 11 +++++++++++ 8 files changed, 42 insertions(+) diff --git a/.github/workflows/deploy_app_store.yml b/.github/workflows/deploy_app_store.yml index c065d75b..a054675e 100644 --- a/.github/workflows/deploy_app_store.yml +++ b/.github/workflows/deploy_app_store.yml @@ -97,3 +97,8 @@ jobs: ${{ env.DSYM_OUTPUT_PATH }} env: TAG_TYPE: App_Store + + - name: Remove keychain + if: ${{ always() }} + run: bundle exec fastlane removeKeychain + continue-on-error: true diff --git a/.github/workflows/deploy_production_firebase.yml b/.github/workflows/deploy_production_firebase.yml index 2b9209c9..ad71aed9 100644 --- a/.github/workflows/deploy_production_firebase.yml +++ b/.github/workflows/deploy_production_firebase.yml @@ -91,3 +91,8 @@ jobs: ${{ env.DSYM_OUTPUT_PATH }} env: TAG_TYPE: Production_Firebase + + - name: Remove keychain + if: ${{ always() }} + run: bundle exec fastlane removeKeychain + continue-on-error: true diff --git a/.github/workflows/deploy_staging_firebase.yml b/.github/workflows/deploy_staging_firebase.yml index d5ac0b71..fff0630a 100644 --- a/.github/workflows/deploy_staging_firebase.yml +++ b/.github/workflows/deploy_staging_firebase.yml @@ -97,3 +97,8 @@ jobs: ${{ env.DSYM_OUTPUT_PATH }} env: TAG_TYPE: Staging_Firebase + + - name: Remove keychain + if: ${{ always() }} + run: bundle exec fastlane removeKeychain + continue-on-error: true diff --git a/.github/workflows/test_upload_build_to_firebase.yml b/.github/workflows/test_upload_build_to_firebase.yml index 3ccdfb6c..5f8d2655 100644 --- a/.github/workflows/test_upload_build_to_firebase.yml +++ b/.github/workflows/test_upload_build_to_firebase.yml @@ -78,3 +78,8 @@ jobs: ${{ env.DSYM_OUTPUT_PATH }} env: TAG_TYPE: Staging_Firebase + + - name: Remove keychain + if: ${{ always() }} + run: bundle exec fastlane removeKeychain + continue-on-error: true diff --git a/.github/workflows/test_upload_build_to_test_flight.yml b/.github/workflows/test_upload_build_to_test_flight.yml index 387c835b..28baf490 100644 --- a/.github/workflows/test_upload_build_to_test_flight.yml +++ b/.github/workflows/test_upload_build_to_test_flight.yml @@ -70,3 +70,8 @@ jobs: ISSUER_ID: ${{ secrets.ISSUER_ID }} SKIP_FIREBASE_DSYM: "true" BUMP_APP_STORE_BUILD_NUMBER: "true" + + - name: Remove keychain + if: ${{ always() }} + run: bundle exec fastlane removeKeychain + continue-on-error: true diff --git a/fastlane/Constants/Constant.swift b/fastlane/Constants/Constant.swift index ae8ddf83..2b434f4f 100644 --- a/fastlane/Constants/Constant.swift +++ b/fastlane/Constants/Constant.swift @@ -37,6 +37,7 @@ enum Constant { static let projectPath: String = "./\(projectName).xcodeproj" static let testOutputDirectoryPath = "./fastlane/test_output" static let infoPlistPath = "\(projectName)/Configurations/Plists/Info.plist" + static let keychainPath = "~/Library/Keychains/\(keychainName)-db" // MARK: Platform diff --git a/fastlane/Fastfile.swift b/fastlane/Fastfile.swift index ccba6fe1..a5377234 100644 --- a/fastlane/Fastfile.swift +++ b/fastlane/Fastfile.swift @@ -51,6 +51,11 @@ class Fastfile: LaneFile { environment: .production ) } + + func removeKeychainLane() { + desc("Delete keychain") + Keychain.remove() + } // MARK: - Build diff --git a/fastlane/Helpers/Keychain.swift b/fastlane/Helpers/Keychain.swift index 4482c788..e06f24a3 100644 --- a/fastlane/Helpers/Keychain.swift +++ b/fastlane/Helpers/Keychain.swift @@ -6,6 +6,8 @@ // Copyright © 2022 Nimble. All rights reserved. // +import Foundation + enum Keychain { static func create() { @@ -17,4 +19,13 @@ enum Keychain { timeout: 3600 ) } + + static func remove() { + guard FileManager.default.fileExists(atPath: Constant.keychainPath) else { + return log(message: "Couldn't find the Keychain") + } + deleteKeychain( + name: .userDefined(Constant.keychainName) + ) + } } From 71ef49ac4fb55b312efe44e76088d09271ca724b Mon Sep 17 00:00:00 2001 From: David Date: Tue, 22 Aug 2023 14:05:48 +0700 Subject: [PATCH 4/6] [#510] Clean up unused code --- fastlane/Constants/Constant.swift | 1 - fastlane/Helpers/Keychain.swift | 3 --- 2 files changed, 4 deletions(-) diff --git a/fastlane/Constants/Constant.swift b/fastlane/Constants/Constant.swift index 2b434f4f..ae8ddf83 100644 --- a/fastlane/Constants/Constant.swift +++ b/fastlane/Constants/Constant.swift @@ -37,7 +37,6 @@ enum Constant { static let projectPath: String = "./\(projectName).xcodeproj" static let testOutputDirectoryPath = "./fastlane/test_output" static let infoPlistPath = "\(projectName)/Configurations/Plists/Info.plist" - static let keychainPath = "~/Library/Keychains/\(keychainName)-db" // MARK: Platform diff --git a/fastlane/Helpers/Keychain.swift b/fastlane/Helpers/Keychain.swift index e06f24a3..522a8704 100644 --- a/fastlane/Helpers/Keychain.swift +++ b/fastlane/Helpers/Keychain.swift @@ -21,9 +21,6 @@ enum Keychain { } static func remove() { - guard FileManager.default.fileExists(atPath: Constant.keychainPath) else { - return log(message: "Couldn't find the Keychain") - } deleteKeychain( name: .userDefined(Constant.keychainName) ) From c37549f18e326eb19d361a7a0277b40266f8792d Mon Sep 17 00:00:00 2001 From: David Date: Thu, 24 Aug 2023 09:51:17 +0700 Subject: [PATCH 5/6] [#510] Update keychainName default value with "{PROJECT_NAME}" to be replaced when run make.sh Update make.sh to accept minimum-version --- fastlane/Constants/Constant.swift | 2 +- make.sh | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/fastlane/Constants/Constant.swift b/fastlane/Constants/Constant.swift index ae8ddf83..a5f96dfd 100644 --- a/fastlane/Constants/Constant.swift +++ b/fastlane/Constants/Constant.swift @@ -26,7 +26,7 @@ enum Constant { static let appleStagingTeamId = "<#teamId#>" static let appleProductionUserName = "<#userName#>" static let appleProductionTeamId = "<#teamId#>" - static let keychainName = "github_action_keychain" + static let keychainName = "{PROJECT_NAME}" static let matchURL = "git@github.com:{organization}/{repo}.git" // MARK: - Path diff --git a/make.sh b/make.sh index b8002381..61a83ee0 100644 --- a/make.sh +++ b/make.sh @@ -17,13 +17,14 @@ usage() { fi cat << EOF -Usage: $PROGNAME --bundle-id [BUNDLE_ID_PRODUCTION] --bundle-id-staging [BUNDLE_ID_STAGING] --project-name [PROJECT_NAME] +Usage: $PROGNAME --bundle-id [BUNDLE_ID_PRODUCTION] --bundle-id-staging [BUNDLE_ID_STAGING] --project-name [PROJECT_NAME] --minimum-version [MINIMUM_VERSION] --interface [INTERFACE] Set up an iOS app from tuist template. Options: -h, --help display this usage message and exit -b, --bundle-id [BUNDLE_ID_PRODUCTION] the production id (i.e. com.example.package) -s, --bundle-id-staging [BUNDLE_ID_STAGING] the staging id (i.e. com.example.package.staging) -n, --project-name [PROJECT_NAME] the project name (i.e. MyApp) +-m, --minimum-version [MINIMUM_VERSION] the minimum version of the project (i.e. 14.0) -i, --interface [INTERFACE] the user interface frameword (SwiftUI or UIKit) EOF exit 1 @@ -52,6 +53,10 @@ while [ $# -gt 0 ] ; do project_name="$2" shift ;; + -m|--minimum-version) + minimum_version="$2" + shift + ;; -i|--interface) interface="$2" shift From 3e873f814110059a1c9cde09468db2691f984e8a Mon Sep 17 00:00:00 2001 From: David Date: Thu, 24 Aug 2023 09:54:55 +0700 Subject: [PATCH 6/6] [#510] Update keychainName default value --- fastlane/Constants/Constant.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/Constants/Constant.swift b/fastlane/Constants/Constant.swift index a5f96dfd..eb134fb6 100644 --- a/fastlane/Constants/Constant.swift +++ b/fastlane/Constants/Constant.swift @@ -26,7 +26,7 @@ enum Constant { static let appleStagingTeamId = "<#teamId#>" static let appleProductionUserName = "<#userName#>" static let appleProductionTeamId = "<#teamId#>" - static let keychainName = "{PROJECT_NAME}" + static let keychainName = "{PROJECT_NAME}_keychain" static let matchURL = "git@github.com:{organization}/{repo}.git" // MARK: - Path