diff --git a/Makefile b/Makefile index 80fe255f9..acbe41d03 100644 --- a/Makefile +++ b/Makefile @@ -150,6 +150,24 @@ do-build-android: build-android: | check-android-target pre-run check-style start-packager prepare-android-build do-build-android stop-packager +do-unsigned-ios: + @echo "Building unsigned iOS app" + @cd fastlane && NODE_ENV=production bundle exec fastlane ios unsigned + @mkdir -p build-ios + @cd ios/ && xcodebuild -project Mattermost.xcodeproj/ -scheme Mattermost -sdk iphoneos -configuration Relase -parallelizeTargets -resultBundlePath ../build-ios/result -derivedDataPath ../build-ios/ CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO + @cd build-ios/ && mkdir -p Payload && cp -R Build/Products/Release-iphoneos/Mattermost.app Payload/ && zip -r Mattermost-unsigned.ipa Payload/ + @mv build-ios/Mattermost-unsigned.ipa . + @rm -rf build-ios/ + +do-unsigned-android: + @echo "Building unsigned Android app" + @cd fastlane && NODE_ENV=production bundle exec fastlane android unsigned + @mv android/app/build/outputs/apk/app-unsigned-unsigned.apk ./Mattermost-unsigned.apk + +unsigned-android: pre-run check-style start-packager do-unsigned-android stop-packager + +unsigned-ios: pre-run check-style start-packager do-unsigned-ios stop-packager + alpha: @: diff --git a/android/app/build.gradle b/android/app/build.gradle index 70acd52bc..a3272f47f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -66,9 +66,12 @@ import com.android.build.OutputFile */ apply from: "../../node_modules/react-native/react.gradle" -apply from: "../../node_modules/react-native-sentry/sentry.gradle" apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" +if (System.getenv("MM_SENTRY_ENABLED") == "true") { + apply from: "../../node_modules/react-native-sentry/sentry.gradle" +} + /** * Set this to true to create two separate APKs instead of one: * - An APK that only works on ARM devices @@ -89,7 +92,7 @@ android { buildToolsVersion "25.0.1" defaultConfig { - applicationId "com.mattermost.rnbeta" + applicationId "com.mattermost.rn" minSdkVersion 16 targetSdkVersion 23 versionCode 49 @@ -128,6 +131,10 @@ android { minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } + unsigned.initWith(buildTypes.release) + unsigned { + signingConfig null + } } // applicationVariants are e.g. debug, release applicationVariants.all { variant -> diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 638ea747c..a6c95ee7f 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -146,6 +146,30 @@ platform :ios do end end + desc 'Build an unsigned ipa' + lane :unsigned do + if ENV['SEGMENT_API_KEY'] + find_replace_string( + path_to_file: './dist/assets/config.json', + old_string: '"SegmentApiKey": "3MT7rAoC0OP7yy3ThzqFSAtKzmzqtUPX"', + new_string: "\"SegmentApiKey\": \"#{ENV['SEGMENT_API_KEY']}\"" + ) + end + + update_app_identifier( + xcodeproj: './ios/Mattermost.xcodeproj', + plist_path: 'Mattermost/Info.plist', + app_identifier: 'com.mattermost.rn' + ) + update_info_plist( + xcodeproj: './ios/Mattermost.xcodeproj', + plist_path: 'Mattermost/Info.plist', + display_name: 'Mattermost' + ) + + sh 'cp -R ../assets/release/icons/ios/* ../ios/Mattermost/Images.xcassets/AppIcon.appiconset/' + end + error do |lane, exception| if ENV['MATTERMOST_WEBHOOK_URL'] send_message_for_ios('', 'Unsuccessful Build', exception.message, [:lane], false) @@ -293,6 +317,57 @@ platform :android do desc 'Deploy a new version to Google Play' lane :release do + prepare_release() + + build_android({ + release: true, + increment_build: false, + ensure_git_status_clean: false + }) + + supply( + track: 'beta', + apk: "#{lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]}", + ) + + + sh 'mv ../android/app/src/main/java/com/mattermost/rn/ ../android/app/src/main/java/com/mattermost/rnbeta/' + + reset_git_repo( + force: true, + skip_clean: true + ) + + if ENV['MATTERMOST_WEBHOOK_URL'] + google_play_url = ENV['GOOGLE_PLAY_URL'] + send_message_for_android( + '#### New Android beta published for Production', + '', + "#android-beta in #{google_play_url.nil? ? 'Google Play' : "[Google Play](#{google_play_url})"} on [#{Time.new.utc.to_s}]", + [], + true + ) + end + end + + desc 'Build an unsigned apk' + lane :unsigned do + prepare_release() + + gradle( + task: 'assemble', + build_type: 'Unsigned', + project_dir: 'android/' + ) + end + + error do |lane, exception| + if ENV['MATTERMOST_WEBHOOK_URL'] + send_message_for_android('', 'Unsuccessful Build', exception.message, [:lane], false) + end + end + + def prepare_release android_change_package_identifier(newIdentifier: 'com.mattermost.rn', manifest: './android/app/src/main/AndroidManifest.xml') android_change_string_app_name(newName: 'Mattermost', stringsFile: './android/app/src/main/res/values/strings.xml') android_update_application_id(app_folder_name: 'android/app', application_id: 'com.mattermost.rn') @@ -367,48 +442,6 @@ platform :android do ) configure_from_env() - - build_android({ - release: true, - increment_build: false, - ensure_git_status_clean: false - }) - - # supply( - # track: "production", - # apk: "#{lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]}", - # ) - - # We are going to upload the build to the beta lane and not directly to production so it can be promoted later - supply( - track: 'beta', - apk: "#{lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]}", - ) - - - sh 'mv ../android/app/src/main/java/com/mattermost/rn/ ../android/app/src/main/java/com/mattermost/rnbeta/' - - reset_git_repo( - force: true, - skip_clean: true - ) - - if ENV['MATTERMOST_WEBHOOK_URL'] - google_play_url = ENV['GOOGLE_PLAY_URL'] - send_message_for_android( - '#### New Android beta published for Production', - '', - "#android-beta in #{google_play_url.nil? ? 'Google Play' : "[Google Play](#{google_play_url})"} on [#{Time.new.utc.to_s}]", - [], - true - ) - end - end - - error do |lane, exception| - if ENV['MATTERMOST_WEBHOOK_URL'] - send_message_for_android('', 'Unsuccessful Build', exception.message, [:lane], false) - end end def build_android(options)