diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 3633b3e7b..dee9596da 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -283,7 +283,7 @@ lane :upload_file_to_s3 do |options| :title => '', :thumb_url => 'https://support.apple.com/library/content/dam/edam/applecare/images/en_US/iOS/move-to-ios-icon.png', :msg => msg, - :default_payloads => [], + :default_payloads => [:git_branch, :last_git_commit_hash], :success => true, }) end diff --git a/fastlane/Gemfile b/fastlane/Gemfile index 473b20e33..1e864103e 100644 --- a/fastlane/Gemfile +++ b/fastlane/Gemfile @@ -2,7 +2,6 @@ source "https://rubygems.org" gem "fastlane" gem "nokogiri" -gem "slack-notifier", "2.3.2" plugins_path = File.join(File.dirname(__FILE__), '.', 'Pluginfile') eval(File.read(plugins_path), binding) if File.exist?(plugins_path) diff --git a/fastlane/Gemfile.lock b/fastlane/Gemfile.lock index 1acefac1f..e0daa89cf 100644 --- a/fastlane/Gemfile.lock +++ b/fastlane/Gemfile.lock @@ -3,12 +3,12 @@ GEM specs: CFPropertyList (3.0.6) rexml - addressable (2.8.1) + addressable (2.8.2) public_suffix (>= 2.0.2, < 6.0) artifactory (3.0.15) atomos (0.1.3) aws-eventstream (1.2.0) - aws-partitions (1.735.0) + aws-partitions (1.740.0) aws-sdk-core (3.171.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) @@ -17,7 +17,7 @@ GEM aws-sdk-kms (1.63.0) aws-sdk-core (~> 3, >= 3.165.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.119.2) + aws-sdk-s3 (1.120.0) aws-sdk-core (~> 3, >= 3.165.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.4) @@ -111,7 +111,7 @@ GEM fastlane-plugin-find_replace_string (0.1.0) fastlane-plugin-versioning_android (0.1.1) gh_inspector (1.1.3) - google-apis-androidpublisher_v3 (0.37.0) + google-apis-androidpublisher_v3 (0.38.0) google-apis-core (>= 0.11.0, < 2.a) google-apis-core (0.11.0) addressable (~> 2.5, >= 2.5.1) @@ -191,7 +191,6 @@ GEM simctl (1.6.10) CFPropertyList naturally - slack-notifier (2.3.2) terminal-notifier (2.0.0) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) @@ -229,7 +228,6 @@ DEPENDENCIES fastlane-plugin-find_replace_string fastlane-plugin-versioning_android nokogiri - slack-notifier (= 2.3.2) BUNDLED WITH 2.3.26 diff --git a/fastlane/actions/mattermost.rb b/fastlane/actions/mattermost.rb index 056ca7367..c064283ef 100644 --- a/fastlane/actions/mattermost.rb +++ b/fastlane/actions/mattermost.rb @@ -2,53 +2,216 @@ # rubocop:disable Style/MultilineTernaryOperator # rubocop:disable Style/NestedTernaryOperator module Fastlane + module Notification + class Mattermost + def initialize(webhook_url) + @webhook_url = webhook_url + @client = Faraday.new do | conn | + conn.use(Faraday::Response::RaiseError) + end + end + + def post_incoming_webhook(channel:, username:, attachments:, icon_url:) + @client.post(@webhook_url) do | request | + request.headers['Content-Type'] = 'application/json' + request.body = { + channel: channel, + username: username, + icon_url: icon_url, + attachments: attachments + }.to_json + end + end + + class LinkFormatter + HTML_PATTERN = %r{#{URI.regexp})['"].*?>(?