diff --git a/.circleci/config.yml b/.circleci/config.yml index 3225b8f63..d2b61f1fb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -141,7 +141,7 @@ commands: working_directory: fastlane name: Run fastlane to build android no_output_timeout: 30m - command: bundle exec fastlane android build || exit 1 + command: bundle exec fastlane android build build-ios: description: "Build the iOS app" @@ -157,7 +157,7 @@ commands: working_directory: fastlane name: Run fastlane to build iOS no_output_timeout: 30m - command: bundle exec fastlane ios build || exit 1 + command: bundle exec fastlane ios build deploy-to-store: description: "Deploy build to store" @@ -238,6 +238,25 @@ jobs: - save: filename: "Mattermost_Beta.apk" + build-android-unsigned: + executor: android + steps: + - checkout: + path: ~/mattermost-mobile + - npm-dependencies + - assets + - fastlane-dependencies: + for: android + - gradle-dependencies + - run: + working_directory: fastlane + name: Run fastlane to build unsigned android + no_output_timeout: 30m + command: bundle exec fastlane android unsigned + - persist + - save: + filename: "Mattermost-unsigned.apk" + build-ios-beta: executor: ios steps: @@ -263,6 +282,25 @@ jobs: - save: filename: "Mattermost_Beta.ipa" + build-ios-unsigned: + executor: ios + steps: + - checkout: + path: ~/mattermost-mobile + - npm-dependencies + - pods-dependencies + - assets + - fastlane-dependencies: + for: ios + - run: + working_directory: fastlane + name: Run fastlane to build unsigned iOS + no_output_timeout: 30m + command: bundle exec fastlane ios unsigned + - persist + - save: + filename: "Mattermost-unsigned.ipa" + deploy-android-release: executor: name: android @@ -299,6 +337,18 @@ jobs: target: ios file: Mattermost_Beta.ipa + github-release: + executor: + name: android + resource_class: medium + steps: + - attach_workspace: + at: ~/ + - run: + name: Create GitHub release + working_directory: fastlane + command: bundle exec fastlane github + workflows: version: 2 build: @@ -403,3 +453,32 @@ workflows: filters: branches: only: /^build-pr-.*/ + + - build-android-unsigned: + context: mattermost-mobile-unsigned + requires: + - test + filters: + tags: + only: /^v(\d+\.)(\d+\.)(\d+)(.*)?$/ + branches: + ignore: /.*/ + - build-ios-unsigned: + context: mattermost-mobile-unsigned + requires: + - test + filters: + tags: + only: /^v(\d+\.)(\d+\.)(\d+)(.*)?$/ + branches: + ignore: /.*/ + - github-release: + context: mattermost-mobile-unsigned + requires: + - build-android-unsigned + - build-ios-unsigned + filters: + tags: + only: /^v(\d+\.)(\d+\.)(\d+)(.*)?$/ + branches: + ignore: /.*/ \ No newline at end of file diff --git a/Makefile b/Makefile index 38d55dcb1..b2345c09e 100644 --- a/Makefile +++ b/Makefile @@ -184,14 +184,7 @@ build-android: | stop pre-build check-style i18n-extract-ci prepare-android-buil unsigned-ios: stop pre-build check-style ## Build an unsigned version of the iOS app $(call start_packager) - @echo "Building unsigned iOS app" @cd fastlane && NODE_ENV=production bundle exec fastlane ios unsigned - @mkdir -p build-ios - @cd ios/ && xcodebuild -workspace Mattermost.xcworkspace/ -scheme Mattermost -sdk iphoneos -configuration Release -parallelizeTargets -resultBundlePath ../build-ios/result -derivedDataPath ../build-ios/ CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=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 . - @cd fastlane && bundle exec fastlane upload_file_to_s3 file:Mattermost-unsigned.ipa os_type:iOS - @rm -rf build-ios/ $(call stop_packager) ios-sim-x86_64: stop pre-build check-style ## Build an unsigned x86_64 version of the iOS app for iPhone simulator @@ -207,12 +200,7 @@ ios-sim-x86_64: stop pre-build check-style ## Build an unsigned x86_64 version o $(call stop_packager) unsigned-android: stop pre-build check-style prepare-android-build ## Build an unsigned version of the Android app - $(call start_packager) - @echo "Building unsigned Android app" @cd fastlane && NODE_ENV=production bundle exec fastlane android unsigned - @mv android/app/build/outputs/apk/unsigned/app-unsigned-unsigned.apk ./Mattermost-unsigned.apk - @cd fastlane && bundle exec fastlane upload_file_to_s3 file:Mattermost-unsigned.apk os_type:Android - $(call stop_packager) test: | pre-run check-style ## Runs tests @npm test diff --git a/android/app/build.gradle b/android/app/build.gradle index 03380f987..f404f140b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -162,7 +162,7 @@ android { unsigned.initWith(buildTypes.release) unsigned { signingConfig null - matchingFallbacks = ['debug', 'release'] + matchingFallbacks = ['release'] } } // applicationVariants are e.g. debug, release diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 7de9d94d8..26d1a3e01 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -17,8 +17,6 @@ before_all do ENV['BRANCH_TO_BUILD'] = ENV['CIRCLE_BRANCH'] end - UI.success("Building for release #{ENV['BUILD_FOR_RELEASE']}") - if ENV['CIRCLECI'] != 'true' # Raises an error is git is not clean if ENV['COMMIT_CHANGES_TO_GIT'] == 'true' @@ -187,19 +185,6 @@ lane :build do |options| build end -desc 'Build the app for Android and iOS unsigned' -lane :unsigned do - configure - - # Build the android app - self.runner.current_platform = :android - unsigned - - # Build the ios app - self.runner.current_platform = :ios - unsigned -end - desc 'Upload file to s3' lane :upload_file_to_s3 do |options| os_type = options[:os_type] @@ -288,6 +273,29 @@ lane :upload_file_to_s3 do |options| end end +desc 'Create GitHub release' +lane :github do + tag = ENV['CIRCLE_TAG'] || ENV['TAG'] + + if tag + version = get_version_number(xcodeproj: './ios/Mattermost.xcodeproj', target: 'Mattermost') + build = get_build_number(xcodeproj: './ios/Mattermost.xcodeproj') + changelog = File.read("metadata/changelog") + changelog.concat("* Android [Mattermost.apk](https://releases.mattermost.com/mattermost-mobile/#{version}/#{build}/Mattermost.apk)\n") + changelog.concat("* iOS [Mattermost.ipa](https://releases.mattermost.com/mattermost-mobile/#{version}/#{build}/Mattermost.ipa)") + + github_release = set_github_release( + repository_name: "mattermost/mattermost-mobile", + api_token: ENV["GITHUB_TOKEN"], + name: "Mobile Version #{version}", + tag_name: tag, + description: changelog, + upload_assets: ["./Mattermost-unsigned.ipa", "./Mattermost-unsigned.apk"], + is_draft: true + ) + end +end + platform :ios do before_all do if ENV['CIRCLECI'] == 'true' @@ -317,11 +325,20 @@ platform :ios do desc 'Build an unsigned ipa' lane :unsigned do - unless configured - configure - end + UI.success('Building unsigned iOS app') + + ENV['APP_NAME'] = 'Mattermost' + ENV['REPLACE_ASSETS'] = 'true' + ENV['BUILD_FOR_RELEASE'] = 'true' + update_identifiers replace_assets + + sh 'mkdir -p ../build-ios' + sh 'cd ../ios/ && xcodebuild -workspace Mattermost.xcworkspace/ -scheme Mattermost -sdk iphoneos -configuration Release -parallelizeTargets -resultBundlePath ../build-ios/result -derivedDataPath ../build-ios/ CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO' + sh 'cd ../build-ios/ && mkdir -p Payload && cp -R Build/Products/Release-iphoneos/Mattermost.app Payload/ && zip -r Mattermost-unsigned.ipa Payload/' + sh 'mv ../build-ios/Mattermost-unsigned.ipa ../' + sh 'rm -rf ../build-ios/' end lane :update_identifiers do @@ -516,9 +533,12 @@ platform :android do desc 'Build an unsigned apk' lane :unsigned do - unless configured - configure - end + UI.success('Building unsigned Android app') + + ENV['APP_NAME'] = 'Mattermost' + ENV['REPLACE_ASSETS'] = 'true' + ENV['BUILD_FOR_RELEASE'] = 'true' + update_identifiers replace_assets @@ -527,6 +547,8 @@ platform :android do build_type: 'Unsigned', project_dir: 'android/' ) + + sh "mv #{lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]} #{Pathname.new(File.expand_path(File.dirname(__FILE__))).parent.to_s}/Mattermost-unsigned.apk" end desc 'Update config and module/listener for Android telemetry' diff --git a/fastlane/Gemfile.lock b/fastlane/Gemfile.lock index 7738a6c5a..b1a6653c8 100644 --- a/fastlane/Gemfile.lock +++ b/fastlane/Gemfile.lock @@ -1,27 +1,27 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.0) - addressable (2.6.0) - public_suffix (>= 2.0.2, < 4.0) + CFPropertyList (3.0.1) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) atomos (0.1.3) aws-eventstream (1.0.3) - aws-partitions (1.203.0) - aws-sdk-core (3.63.0) + aws-partitions (1.228.0) + aws-sdk-core (3.72.0) aws-eventstream (~> 1.0, >= 1.0.2) - aws-partitions (~> 1.0) + aws-partitions (~> 1, >= 1.228.0) aws-sigv4 (~> 1.1) jmespath (~> 1.0) - aws-sdk-kms (1.24.0) - aws-sdk-core (~> 3, >= 3.61.1) + aws-sdk-kms (1.25.0) + aws-sdk-core (~> 3, >= 3.71.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.46.0) - aws-sdk-core (~> 3, >= 3.61.1) + aws-sdk-s3 (1.51.0) + aws-sdk-core (~> 3, >= 3.71.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.1) aws-sigv4 (1.1.0) aws-eventstream (~> 1.0, >= 1.0.2) - babosa (1.0.2) + babosa (1.0.3) claide (1.0.3) colored (1.2) colored2 (3.1.2) @@ -34,16 +34,16 @@ GEM unf (>= 0.0.5, < 1.0.0) dotenv (2.7.5) emoji_regex (1.0.1) - excon (0.66.0) - faraday (0.15.4) + excon (0.68.0) + faraday (0.17.0) multipart-post (>= 1.2, < 3) faraday-cookie_jar (0.0.6) faraday (>= 0.7.4) http-cookie (~> 1.0.0) faraday_middleware (0.13.1) faraday (>= 0.7.4, < 1.0) - fastimage (2.1.5) - fastlane (2.129.0) + fastimage (2.1.7) + fastlane (2.134.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.3, < 3.0.0) babosa (>= 1.0.2, < 2.0.0) @@ -53,9 +53,9 @@ GEM dotenv (>= 2.1.1, < 3.0.0) emoji_regex (>= 0.1, < 2.0) excon (>= 0.45.0, < 1.0.0) - faraday (~> 0.9) + faraday (~> 0.17) faraday-cookie_jar (~> 0.0.6) - faraday_middleware (~> 0.9) + faraday_middleware (~> 0.13.1) fastimage (>= 2.1.0, < 3.0.0) gh_inspector (>= 1.1.2, < 2.0.0) google-api-client (>= 0.21.2, < 0.24.0) @@ -68,7 +68,7 @@ GEM multipart-post (~> 2.0.0) plist (>= 3.1.0, < 4.0.0) public_suffix (~> 2.0.0) - rubyzip (>= 1.2.2, < 2.0.0) + rubyzip (>= 1.3.0, < 2.0.0) security (= 0.1.3) simctl (~> 1.6.3) slack-notifier (>= 2.0.0, < 3.0.0) @@ -94,9 +94,9 @@ GEM representable (~> 3.0) retriable (>= 2.0, < 4.0) signet (~> 0.9) - google-cloud-core (1.3.0) + google-cloud-core (1.4.0) google-cloud-env (~> 1.0) - google-cloud-env (1.2.0) + google-cloud-env (1.3.0) faraday (~> 0.11) google-cloud-storage (1.16.0) digest-crc (~> 0.4) @@ -118,12 +118,12 @@ GEM json (2.2.0) jwt (2.1.0) memoist (0.16.0) - mime-types (3.2.2) + mime-types (3.3) mime-types-data (~> 3.2015) - mime-types-data (3.2019.0331) + mime-types-data (3.2019.1009) mini_magick (4.9.5) mini_portile2 (2.4.0) - multi_json (1.13.1) + multi_json (1.14.1) multi_xml (0.6.0) multipart-post (2.0.0) nanaimo (0.2.6) @@ -139,14 +139,14 @@ GEM uber (< 0.2.0) retriable (3.1.2) rouge (2.0.7) - rubyzip (1.2.3) + rubyzip (1.3.0) security (0.1.3) - signet (0.11.0) + signet (0.12.0) addressable (~> 2.3) faraday (~> 0.9) jwt (>= 1.5, < 3.0) multi_json (~> 1.10) - simctl (1.6.5) + simctl (1.6.6) CFPropertyList naturally slack-notifier (2.3.2) @@ -163,7 +163,7 @@ GEM unf_ext (0.0.7.6) unicode-display_width (1.6.0) word_wrap (1.0.0) - xcodeproj (1.12.0) + xcodeproj (1.13.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) diff --git a/fastlane/metadata/changelog b/fastlane/metadata/changelog new file mode 100644 index 000000000..b3b7c8322 --- /dev/null +++ b/fastlane/metadata/changelog @@ -0,0 +1,5 @@ +This version is compatible with Mattermost servers v5.9+. + +Please see [changelog](https://github.com/mattermost/mattermost-mobile/blob/master/CHANGELOG.md) for full release notes. If you're interested in helping beta test upcoming versions before they are released, please see our [documentation](https://github.com/mattermost/mattermost-mobile#testing). + +### Downloads diff --git a/patches/react-native+0.59.9.patch b/patches/react-native+0.59.9.patch index a846cd491..1d20c33ff 100644 --- a/patches/react-native+0.59.9.patch +++ b/patches/react-native+0.59.9.patch @@ -23,3 +23,25 @@ index d464e6a..6c397c5 100644 [attributedText addAttribute:NSAttachmentAttributeName value:attachment range:range]; } ]; +diff --git a/node_modules/react-native/react.gradle b/node_modules/react-native/react.gradle +index f10a00b..467f7a5 100644 +--- a/node_modules/react-native/react.gradle ++++ b/node_modules/react-native/react.gradle +@@ -58,7 +58,7 @@ afterEvaluate { + + // Set up dev mode + def devEnabled = !(config."devDisabledIn${targetName}" +- || targetName.toLowerCase().contains("release")) ++ || targetName.toLowerCase().contains("release") || targetName.toLowerCase().contains("unsigned")) + + def extraArgs = extraPackagerArgs; + +@@ -78,7 +78,7 @@ afterEvaluate { + + enabled config."bundleIn${targetName}" || + config."bundleIn${variant.buildType.name.capitalize()}" ?: +- targetName.toLowerCase().contains("release") ++ (targetName.toLowerCase().contains("release") || targetName.toLowerCase().contains("unsigned")) + } + + // Expose a minimal interface on the application variant and the task itself: