From 56c6e6b23a6cac1359adeb108a94ec98026d8a38 Mon Sep 17 00:00:00 2001 From: Denis Zhdanov Date: Thu, 2 Jan 2025 22:48:27 +0800 Subject: [PATCH] #9 Prepare iphone native version --- .github/workflows/release.yml | 33 +++++++++++++++++++++++++--- ios/GithubActionsExportOptions.plist | 29 ++++++++++++++++++++++++ ios/Runner.xcodeproj/project.pbxproj | 21 +++++++++++++----- 3 files changed, 74 insertions(+), 9 deletions(-) create mode 100644 ios/GithubActionsExportOptions.plist diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f994fe7..f726eaf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,6 +29,7 @@ jobs: - name: prepare sensitive data run: | + # android echo "${{ secrets.FIREBASE_OPTIONS_DART }}" | base64 -d >> ./lib/firebase_options.dart echo "${{ secrets.GOOGLE_SERVICE_JSON }}" | base64 -d >> ./android/app/google-services.json echo "${{ secrets.RELEASE_KEYSTORE }}" | base64 -d >> ./android/app/chrono-sheet.jks @@ -36,9 +37,29 @@ jobs: echo "storePassword=${{ secrets.RELEASE_KEYSTORE_PASSWORD }}" >> ./android/key.properties echo "keyPassword=${{ secrets.RELEASE_KEYSTORE_PASSWORD }}" >> ./android/key.properties echo "keyAlias=${{ secrets.RELEASE_KEYSTORE_KEY }}" >> ./android/key.properties + + # ios + CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 + PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision + KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db + echo "${{ secrets.INFO_PLIST }}" | base64 -d >> ./ios/Runner/Info.plist echo "${{ secrets.GOOGLE_SERVICE_INFO_PLIST }}" | base64 -d >> ./ios/Runner/GoogleService-Info.plist - echo "${{ secrets.IPHONE_CERTIFICATE_P12 }}" | base64 -d >> $RUNNER_TEMP/build_certificate.p12 + echo "${{ secrets.IPHONE_CERTIFICATE_P12 }}" | base64 -d >> $CERTIFICATE_PATH + echo "${{ secrets.IPHONE_PROVISIONING_PROFILE }}" | base64 -d >> $PP_PATH + + # create temporary keychain + security create-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" $KEYCHAIN_PATH + security set-keychain-settings -lut 21600 $KEYCHAIN_PATH + security unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" $KEYCHAIN_PATH + + # import certificate to keychain + security import $CERTIFICATE_PATH -P "${{ secrets.IPHONE_CERTIFICATE_PASSWORD }}" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH + security list-keychain -d user -s $KEYCHAIN_PATH + + # apply provisioning profile + mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles + cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles - name: generate l10n run: flutter gen-l10n @@ -94,5 +115,11 @@ jobs: name: aab path: build/app/outputs/bundle/release/app-release.aab -# - name: build ios -# run: flutter build ios --no-codesign \ No newline at end of file + - name: build ios + run: flutter build ipa --release --export-options-plist ios/GithubActionsExportOptions.plist + + - name: Clean up keychain and provisioning profile + if: ${{ always() }} + run: | + security delete-keychain $RUNNER_TEMP/app-signing.keychain-db + rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision \ No newline at end of file diff --git a/ios/GithubActionsExportOptions.plist b/ios/GithubActionsExportOptions.plist new file mode 100644 index 0000000..b226c86 --- /dev/null +++ b/ios/GithubActionsExportOptions.plist @@ -0,0 +1,29 @@ + + + + + destination + export + generateAppStoreInformation + + manageAppVersionAndBuildNumber + + method + app-store-connect + signingStyle + manual + stripSwiftSymbols + + teamID + B73F2CBGJ7 + testFlightInternalTestingOnly + + uploadSymbols + + provisioningProfiles + + tech.harmonysoft.oss.chronoSheet + chrono-sheet-app-store-connect + + + diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index c7f1495..5a9a9e1 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -515,9 +515,11 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = B73F2CBGJ7; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = B73F2CBGJ7; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "Chrono Sheet"; @@ -530,6 +532,7 @@ PRODUCT_BUNDLE_IDENTIFIER = tech.harmonysoft.oss.chronoSheet; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "chrono-sheet-app-store-connect"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; @@ -712,9 +715,11 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = B73F2CBGJ7; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = B73F2CBGJ7; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "Chrono Sheet"; @@ -727,6 +732,7 @@ PRODUCT_BUNDLE_IDENTIFIER = tech.harmonysoft.oss.chronoSheet; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "chrono-sheet-app-store-connect"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; @@ -747,9 +753,11 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = B73F2CBGJ7; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = B73F2CBGJ7; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "Chrono Sheet"; @@ -762,6 +770,7 @@ PRODUCT_BUNDLE_IDENTIFIER = tech.harmonysoft.oss.chronoSheet; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "chrono-sheet-app-store-connect"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;