From 5ba720138d963f9716114dfabdc0e9725cb4f399 Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Wed, 3 Feb 2021 23:49:18 +0100 Subject: [PATCH] Test release --- .github/workflows/staging.yml | 1 + fastlane/Fastfile | 172 +++++++++--------- ios/tooot.xcodeproj/project.pbxproj | 22 --- ios/tooot/Base.lproj/LaunchScreen.xib | 24 ++- ios/tooot/Info.plist | 2 +- ios/tooot/Supporting/Expo.plist | 2 +- .../Supporting/en.lproj/InfoPlist.strings | 2 - .../Supporting/zh.lproj/InfoPlist.strings | 2 - package.json | 4 +- 9 files changed, 107 insertions(+), 124 deletions(-) delete mode 100644 ios/tooot/Supporting/en.lproj/InfoPlist.strings delete mode 100644 ios/tooot/Supporting/zh.lproj/InfoPlist.strings diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 2e779826..e0d5c469 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -41,4 +41,5 @@ jobs: APP_STORE_CONNECT_API_KEY_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY_ID }} APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ISSUER_ID }} APP_STORE_CONNECT_API_KEY_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: yarn ios:build diff --git a/fastlane/Fastfile b/fastlane/Fastfile index aacaafa8..246bba94 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -1,4 +1,5 @@ fastlane_version "2.172.0" +skip_docs ensure_env_vars( env_vars: ["TOOOT_ENVIRONMENT"] @@ -8,95 +9,96 @@ VERSIONS = read_json( json_path: "./package.json" )[:versions] ENVIRONMENT = ENV["TOOOT_ENVIRONMENT"] VERSION = "#{VERSIONS[:major]}.#{VERSIONS[:minor]}" RELEASE_CHANNEL = "#{VERSIONS[:major]}-#{ENVIRONMENT}" -BUILD_NUMBER = Time.now.strftime("%y%m%d") +BUILD_NUMBER = number_of_commits +GITHUB_REPO = "tooot-app/app" +case ENVIRONMENT +when "staging" + GITHUB_RELEASE = "v#{VERSION} (#{BUILD_NUMBER})" +when "production" + GITHUB_RELEASE = "v#{VERSION}" +end -platform :ios do - XCODEPROJ = "./ios/tooot.xcodeproj" - INFO_PLIST = "./ios/tooot/Info.plist" - EXPO_PLIST = "./ios/tooot/Supporting/Expo.plist" +XCODEPROJ = "./ios/tooot.xcodeproj" +INFO_PLIST = "./ios/tooot/Info.plist" +EXPO_PLIST = "./ios/tooot/Supporting/Expo.plist" - desc "Prepare app store" - private_lane :prepare_appstore do - case ENVIRONMENT - when "staging", "production" - increment_build_number( xcodeproj: XCODEPROJ, build_number: BUILD_NUMBER ) - app_store_connect_api_key - end - end - - desc "Expo release" - private_lane :expo_release do - yarn( package_path: "./package.json", flags: "release", command: RELEASE_CHANNEL ) - end - - desc "Get certificates" - private_lane :get_certificates do |options| - if ENV['CI'] == true - match( type: options[:type], readonly: true ) - else - match( type: options[:type], readonly: true ) - end - end - - desc "Build and deploy" - lane :build do - BUILD_DIRECTORY = "./ios/build" - SHOULD_BUILD_NATIVE = false - - case ENVIRONMENT - when "staging", "production" - PREVIOUS_VERSION = get_info_plist_value( path: INFO_PLIST, key: "CFBundleShortVersionString" ) - if VERSION.to_f > PREVIOUS_VERSION.to_f - SHOULD_BUILD_NATIVE = true - set_info_plist_value( path: INFO_PLIST, key: "CFBundleShortVersionString", value: VERSION ) - set_info_plist_value( path: EXPO_PLIST, key: "EXUpdatesSDKVersion", value: VERSIONS[:expo] ) - set_info_plist_value( path: EXPO_PLIST, key: "EXUpdatesReleaseChannel", value: RELEASE_CHANNEL ) - end - when "development" - SHOULD_BUILD_NATIVE = true - end - - if SHOULD_BUILD_NATIVE == true - prepare_appstore - - setup_ci - - case ENVIRONMENT - when "development" - get_certificates( type: "development" ) - build_ios_app( - export_method: "development", - output_directory: BUILD_DIRECTORY, - output_name: VERSION + "-" + BUILD_NUMBER - ) - install_on_device( skip_wifi: true ) - when "staging" - get_certificates( type: "appstore" ) - build_ios_app( - export_method: "app-store", - output_directory: BUILD_DIRECTORY, - output_name: VERSION + "-" + BUILD_NUMBER - ) - upload_to_testflight( - demo_account_required: true, - distribute_external: true, - groups: "内测用户", - changelog: "Ready for testing" - ) - when "production" - get_certificates( type: "appstore" ) - build_ios_app( - export_method: "app-store", - output_directory: BUILD_DIRECTORY, - output_name: VERSION + "-" + BUILD_NUMBER - ) - end - end - - expo_release +desc "IOS: Prepare app store" +private_lane :prepare_appstore do + case ENVIRONMENT + when "staging", "production" + increment_build_number( xcodeproj: XCODEPROJ, build_number: BUILD_NUMBER ) + app_store_connect_api_key end end -platform :android do +desc 'IOS: Update version information' +private_lane :update_versions do + set_info_plist_value( path: INFO_PLIST, key: "CFBundleShortVersionString", value: VERSION ) + set_info_plist_value( path: EXPO_PLIST, key: "EXUpdatesSDKVersion", value: VERSIONS[:expo] ) + set_info_plist_value( path: EXPO_PLIST, key: "EXUpdatesReleaseChannel", value: RELEASE_CHANNEL ) +end +desc "Create new GitHub release" +private_lane :github_release do + set_github_release( + repository_name: GITHUB_REPO, + api_bearer: ENV["GITHUB_TOKEN"], + name: GITHUB_RELEASE, + tag_name: GITHUB_RELEASE, + commitish: git_branch, + is_prerelease: ENVIRONMENT == "staging" + ) +end + +desc "Expo release" +private_lane :expo_release do + yarn( package_path: "./package.json", flags: "release", command: RELEASE_CHANNEL ) +end + +desc "Build and deploy" +private_lane :build_ios do + BUILD_DIRECTORY = "./ios/build" + + update_versions + prepare_appstore + setup_ci + + case ENVIRONMENT + when "development" + match( type: "development", readonly: true ) + match_certificates( type: "development" ) + build_ios_app( export_method: "development", output_directory: BUILD_DIRECTORY, output_name: "#{VERSION}-#{BUILD_NUMBER}" ) + install_on_device( skip_wifi: true ) + when "staging" + match( type: "appstore", readonly: true ) + build_ios_app( export_method: "app-store" ) + upload_to_testflight( + demo_account_required: true, + distribute_external: true, + groups: "内测用户", + changelog: "Ready for testing" + ) + when "production" + match( type: "appstore", readonly: true ) + build_ios_app( export_method: "app-store" ) + end +end + +lane :build do + releaseExists = get_github_release(url: GITHUB_REPO, version: GITHUB_RELEASE) + if releaseExists + puts("Release #{GITHUB_RELEASE} exists. Continue with building React Native only.") + else + puts("Release #{GITHUB_RELEASE} does not exist. Create new release as well as new native build.") + build_ios + # build_android + case ENVIRONMENT + when "staging" + github_release + when "production" + github_release + end + end + expo_release + rocket end \ No newline at end of file diff --git a/ios/tooot.xcodeproj/project.pbxproj b/ios/tooot.xcodeproj/project.pbxproj index 47cd9804..28d2752e 100644 --- a/ios/tooot.xcodeproj/project.pbxproj +++ b/ios/tooot.xcodeproj/project.pbxproj @@ -13,8 +13,6 @@ 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 3E461D99554A48A4959DE609 /* SplashScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */; }; 5E36538325C9B8BD009F93EE /* RootViewColor.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5E36538225C9B8BD009F93EE /* RootViewColor.xcassets */; }; - 6CB3B7B773184F6EB8040C3E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4C2DAF0391E246238BE2A4B4 /* InfoPlist.strings */; }; - 8BA74ECC129842FEA0CC08AF /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F78D778B9BBC48D584012340 /* InfoPlist.strings */; }; 96905EF65AED1B983A6B3ABC /* libPods-tooot.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 58EEBF8E8E6FB1BC6CAF49B5 /* libPods-tooot.a */; }; BB2F792D24A3F905000567C9 /* Expo.plist in Resources */ = {isa = PBXBuildFile; fileRef = BB2F792C24A3F905000567C9 /* Expo.plist */; }; DA8B5B7F0DED488CAC0FF169 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = B96B72E5384D44A7B240B27E /* GoogleService-Info.plist */; }; @@ -29,7 +27,6 @@ 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = tooot/Images.xcassets; sourceTree = ""; }; 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = tooot/Info.plist; sourceTree = ""; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = tooot/main.m; sourceTree = ""; }; - 4C2DAF0391E246238BE2A4B4 /* InfoPlist.strings */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = text.plist.strings; name = InfoPlist.strings; path = /Users/zhzhe/Documents/GitHub/tooot/app/ios/tooot/Supporting/en.lproj/InfoPlist.strings; sourceTree = ""; }; 58EEBF8E8E6FB1BC6CAF49B5 /* libPods-tooot.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-tooot.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 5E36538225C9B8BD009F93EE /* RootViewColor.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = RootViewColor.xcassets; path = tooot/RootViewColor.xcassets; sourceTree = ""; }; 6C2E3173556A471DD304B334 /* Pods-tooot.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-tooot.debug.xcconfig"; path = "Target Support Files/Pods-tooot/Pods-tooot.debug.xcconfig"; sourceTree = ""; }; @@ -39,7 +36,6 @@ BB2F792C24A3F905000567C9 /* Expo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Expo.plist; sourceTree = ""; }; ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; }; - F78D778B9BBC48D584012340 /* InfoPlist.strings */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = text.plist.strings; name = InfoPlist.strings; path = /Users/zhzhe/Documents/GitHub/tooot/app/ios/tooot/Supporting/zh.lproj/InfoPlist.strings; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -54,14 +50,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 0351DE0CE9C448D9B63B2FD1 /* en.lproj */ = { - isa = PBXGroup; - children = ( - 4C2DAF0391E246238BE2A4B4 /* InfoPlist.strings */, - ); - name = en.lproj; - sourceTree = ""; - }; 13B07FAE1A68108700A75B9A /* tooot */ = { isa = PBXGroup; children = ( @@ -80,14 +68,6 @@ name = tooot; sourceTree = ""; }; - 24C1D590D0854BB1A4D480A6 /* zh.lproj */ = { - isa = PBXGroup; - children = ( - F78D778B9BBC48D584012340 /* InfoPlist.strings */, - ); - name = zh.lproj; - sourceTree = ""; - }; 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { isa = PBXGroup; children = ( @@ -214,8 +194,6 @@ 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, 3E461D99554A48A4959DE609 /* SplashScreen.storyboard in Resources */, - 6CB3B7B773184F6EB8040C3E /* InfoPlist.strings in Resources */, - 8BA74ECC129842FEA0CC08AF /* InfoPlist.strings in Resources */, DA8B5B7F0DED488CAC0FF169 /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/ios/tooot/Base.lproj/LaunchScreen.xib b/ios/tooot/Base.lproj/LaunchScreen.xib index 9c290399..b170185e 100644 --- a/ios/tooot/Base.lproj/LaunchScreen.xib +++ b/ios/tooot/Base.lproj/LaunchScreen.xib @@ -1,9 +1,10 @@ - - + + + - - + + @@ -12,20 +13,20 @@ - - + @@ -39,4 +40,9 @@ + + + + + diff --git a/ios/tooot/Info.plist b/ios/tooot/Info.plist index f0ccbe67..e1c9da22 100644 --- a/ios/tooot/Info.plist +++ b/ios/tooot/Info.plist @@ -19,7 +19,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.1 + 0.2 CFBundleSignature ???? CFBundleURLTypes diff --git a/ios/tooot/Supporting/Expo.plist b/ios/tooot/Supporting/Expo.plist index 78942c5a..51168cbe 100644 --- a/ios/tooot/Supporting/Expo.plist +++ b/ios/tooot/Supporting/Expo.plist @@ -9,7 +9,7 @@ EXUpdatesLaunchWaitMs 0 EXUpdatesReleaseChannel - 0-staging + 0-development EXUpdatesSDKVersion 40.0.0 EXUpdatesURL diff --git a/ios/tooot/Supporting/en.lproj/InfoPlist.strings b/ios/tooot/Supporting/en.lproj/InfoPlist.strings deleted file mode 100644 index 6c473360..00000000 --- a/ios/tooot/Supporting/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -NSCameraUsageDescription = "Allow camera access to upload attachments"; -NSPhotoLibraryUsageDescription = "Allow photo library access to upload attachments"; \ No newline at end of file diff --git a/ios/tooot/Supporting/zh.lproj/InfoPlist.strings b/ios/tooot/Supporting/zh.lproj/InfoPlist.strings deleted file mode 100644 index b08aca07..00000000 --- a/ios/tooot/Supporting/zh.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -NSCameraUsageDescription = "允许tooot使用相机拍摄上传附件"; -NSPhotoLibraryUsageDescription = "允许tooot读取相册上传附件"; \ No newline at end of file diff --git a/package.json b/package.json index 99be2fe2..df3a805b 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "start": "react-native start", "android": "react-native run-android", "ios": "react-native run-ios", - "ios:build": "bundle exec fastlane ios build", + "app:build": "bundle exec fastlane build", "test": "jest --watchAll", "release": "scripts/release.sh" }, @@ -108,7 +108,7 @@ "versions": { "native": "210201", "major": 0, - "minor": 8, + "minor": 2, "patch": 0, "expo": "40.0.0" }