From 77140f8730b92038f06da84d77d78cee3c5cfe6f Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Fri, 11 May 2018 18:06:09 -0300 Subject: [PATCH] Fastlane sign with iCloud (#1663) --- fastlane/Fastfile | 57 ++++++++++++++++++++++++++++++++-- fastlane/Gemfile.lock | 14 ++++----- fastlane/actions/mattermost.rb | 19 ++++++------ 3 files changed, 71 insertions(+), 19 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index d412befc4..933773aa7 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -25,6 +25,8 @@ platform :ios do desc 'Build iOS app' lane :build do + update_identifiers() + if ENV['SYNC_IOS_PROVISIONING_PROFILES'] == 'true' match(type: ENV['MATCH_TYPE'] || 'adhoc') end @@ -38,6 +40,22 @@ platform :ios do end git_actions() + + if ENV['MATTERMOST_WEBHOOK_URL'] + pretext = '#### New iOS beta published to TestFlight' + msg = '#ios-beta should be available in TestFlight soon, you can sign up as a beta tester [here](https://mattermost-fastlane.herokuapp.com/)' + if !ENV['BETA_BUILD'].nil? && !ENV['BETA_BUILD'].empty? && ENV['BETA_BUILD'] != 'true' + pretext = '#### New iOS released ready to be published' + msg = '#ios-release has been cut and should be available for [download](https://itunes.apple.com/us/app/mattermost/id1257222717?mt=8) soon.' + end + send_message_for_ios( + pretext, + '', + msg, + [], + true + ) + end end desc 'Build an unsigned ipa' @@ -55,6 +73,7 @@ platform :ios do end lane :build_qa do + update_identifiers() match(type: 'adhoc') build_ios @@ -92,6 +111,12 @@ platform :ios do plist_path: 'Mattermost/Info.plist', app_identifier: ENV['IOS_MAIN_APP_IDENTIFIER'] ) + + find_replace_string( + path_to_file: './ios/Mattermost.xcodeproj/project.pbxproj', + old_string: 'com.mattermost.rnbeta', + new_string: ENV['IOS_MAIN_APP_IDENTIFIER'] + ) end unless ENV['IOS_ICLOUD_CONTAINER'].nil? || ENV['IOS_ICLOUD_CONTAINER'].empty? || ENV['IOS_ICLOUD_CONTAINER'] == 'iCloud.com.mattermost.rnbeta' @@ -128,6 +153,12 @@ platform :ios do plist_path: 'MattermostShare/Info.plist', app_identifier: ENV['IOS_EXTENSION_APP_IDENTIFIER'] ) + + find_replace_string( + path_to_file: './ios/Mattermost.xcodeproj/project.pbxproj', + old_string: 'com.mattermost.rnbeta.MattermostShare', + new_string: ENV['IOS_EXTENSION_APP_IDENTIFIER'] + ) end end end @@ -163,7 +194,6 @@ platform :ios do commit_version_bump(commit_version_options) end - update_identifiers() replace_ios_assets() unless ENV['FASTLANE_TEAM_ID'].nil? || ENV['FASTLANE_TEAM_ID'].empty? @@ -181,12 +211,17 @@ platform :ios do scheme: 'Mattermost', configuration: config_mode, workspace: './ios/Mattermost.xcworkspace', - export_method: method + export_method: method, + skip_profile_detection: true, + export_options: { + signingStyle: 'manual', + iCloudContainerEnvironment: 'Production' + } ) end def send_message_for_ios(pretext, title, msg, default_payloads, success) - version = get_version_number(xcodeproj: './ios/Mattermost.xcodeproj') + version = get_version_number(xcodeproj: './ios/Mattermost.xcodeproj', target: 'Mattermost') build_number = get_build_number(xcodeproj: './ios/Mattermost.xcodeproj') mattermost( pretext: pretext, @@ -264,6 +299,22 @@ platform :android do sh "mv #{apk_path} ../Mattermost.apk" git_actions() + + if ENV['MATTERMOST_WEBHOOK_URL'] + pretext = '#### New Android beta published to Google Play' + msg = '#android-beta available for testing, you can sign up as a beta tester [here](https://play.google.com/apps/testing/com.mattermost.rnbeta)' + if !ENV['BETA_BUILD'].nil? && !ENV['BETA_BUILD'].empty? && ENV['BETA_BUILD'] != 'true' + pretext = '#### New Android released ready to be published' + msg = '#android-release has been cut and should be available for [download](https://play.google.com/store/apps/details?id=com.mattermost.rn&hl=en) soon.' + end + send_message_for_android( + pretext, + '', + msg, + [], + true + ) + end end desc 'Build an unsigned apk' diff --git a/fastlane/Gemfile.lock b/fastlane/Gemfile.lock index 984085983..e27558106 100644 --- a/fastlane/Gemfile.lock +++ b/fastlane/Gemfile.lock @@ -5,15 +5,15 @@ GEM addressable (2.5.2) public_suffix (>= 2.0.2, < 4.0) atomos (0.1.2) - aws-partitions (1.81.0) - aws-sdk-core (3.20.1) + aws-partitions (1.84.0) + aws-sdk-core (3.20.2) aws-partitions (~> 1.0) aws-sigv4 (~> 1.0) jmespath (~> 1.0) aws-sdk-kms (1.5.0) aws-sdk-core (~> 3) aws-sigv4 (~> 1.0) - aws-sdk-s3 (1.9.1) + aws-sdk-s3 (1.10.0) aws-sdk-core (~> 3) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.0) @@ -38,8 +38,8 @@ GEM http-cookie (~> 1.0.0) faraday_middleware (0.12.2) faraday (>= 0.7.4, < 1.0) - fastimage (2.1.1) - fastlane (2.93.1) + fastimage (2.1.3) + fastlane (2.95.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.3, < 3.0.0) babosa (>= 1.0.2, < 2.0.0) @@ -152,12 +152,12 @@ GEM unf_ext (0.0.7.5) unicode-display_width (1.3.2) word_wrap (1.0.0) - xcodeproj (1.5.7) + xcodeproj (1.5.8) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.2) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) - nanaimo (~> 0.2.4) + nanaimo (~> 0.2.5) xcpretty (0.2.8) rouge (~> 2.0.7) xcpretty-travis-formatter (1.0.0) diff --git a/fastlane/actions/mattermost.rb b/fastlane/actions/mattermost.rb index 626a4617c..056ca7367 100644 --- a/fastlane/actions/mattermost.rb +++ b/fastlane/actions/mattermost.rb @@ -22,26 +22,27 @@ module Fastlane require 'slack-notifier' options[:message] = self.trim_message(options[:message].to_s || '') - options[:message] = Slack::Notifier::LinkFormatter.format(options[:message]) + options[:message] = Slack::Notifier::Util::LinkFormatter.format(options[:message]) - notifier = Slack::Notifier.new(options[:mattermost_url]) - - notifier.username = options[:overwrite_webhook_username_and_icon] ? nil : options[:username] + username = options[:overwrite_webhook_username_and_icon] ? nil : options[:username] icon_url = options[:overwrite_webhook_username_and_icon] ? nil : options[:icon_url] if options[:channel].to_s.length > 0 - notifier.channel = options[:channel] - notifier.channel = ('#' + notifier.channel) unless ['#', '@'].include?(notifier.channel[0]) # send message to channel by default + channel = options[:channel] + channel = ('#' + channel) unless ['#', '@'].include?(channel[0]) # send message to channel by default end + notifier = Slack::Notifier.new(options[:mattermost_url], channel: channel, username: username) + mattermost_attachment = generate_mattermost_attachments(options) return [notifier, mattermost_attachment] if Helper.is_test? # tests will verify the mattermost attachments and other properties - result = notifier.ping '', + results = notifier.ping '', icon_url: icon_url, attachments: [mattermost_attachment] + result = results.first if result.code.to_i == 200 UI.success('Successfully sent Mattermost notification') else @@ -75,7 +76,7 @@ module Fastlane is_string: false, optional: true), FastlaneCore::ConfigItem.new(key: :mattermost_url, - env_name: "MATTERMOST_URL", + env_name: "MATTERMOST_WEBHOOK_URL", sensitive: true, description: "Create an Incoming WebHook for your Mattermost channel", verify_block: proc do |value| @@ -84,7 +85,7 @@ module Fastlane FastlaneCore::ConfigItem.new(key: :username, env_name: "MATTERMOST_USERNAME", description: "Overrides the webook's username property if overwrite_webhook_username_and_icon is false", - default_value: "fastlane", + default_value: "Fastlane", is_string: true, optional: true), FastlaneCore::ConfigItem.new(key: :icon_url,