fastlane: Slack blocks support for more styling

New Issue Checklist

Issue Description

Fastlane has slack support, but the message creation is the default that slack has to offer. Slack also supports blocks (https://api.slack.com/messaging/composing/layouts) which provides a way to really customise your messages. I’ve tried a few things, but I don’t think it is supported yet in Fastlane.

Environment

🚫 fastlane environment 🚫

Stack

Key Value
OS 10.15.7
Ruby 2.7.0
Bundler? false
Git git version 2.24.3 (Apple Git-128)
Installation Source /usr/local/lib/ruby/gems/2.7.0/bin/fastlane
Host Mac OS X 10.15.7 (19H2)
Ruby Lib Dir /usr/local/Cellar/ruby/2.7.0/lib
OpenSSL Version OpenSSL 1.1.1d 10 Sep 2019
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode.app/Contents/Developer/
Xcode Version 11.5

System Locale

Error
No Locale with UTF8 found 🚫

fastlane files:

`./fastlane/Fastfile`
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
#     https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
#     https://docs.fastlane.tools/plugins/available-plugins
#

# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane

default_platform(:android)

platform :android do
  @impelStagingAppcenterName = "IMPEL-1"
  @impelReleaseAppcenterName = "Impel-Release"
  @hasAskedVersionUpdate = false

  def askUserVersionsUpdated
    if @hasAskedVersionUpdate == true
      return
    end

    notification(subtitle: "Android Impel Question", message: "Did you update all versions?")
    versionsAreUpdated = prompt(
      text: "Did you update all the versions of every build you're about to create?",
      boolean: true
    )
    if versionsAreUpdated != true 
      UI.user_error!("You did not update all versions")
    end

    @hasAskedVersionUpdate = true
  end

  #############################################
  ### General
  #############################################
  before_all do |lane, options|
    askUserVersionsUpdated()
  end

  desc "Upload to App Center"
  private_lane :upload_appcenter do |options|
    apk_path = lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]
    mapping_path = lane_context[SharedValues::GRADLE_MAPPING_TXT_OUTPUT_PATH]

    # https://github.com/microsoft/fastlane-plugin-appcenter
    appcenter_upload(
      api_token: "8e641a0b3af4390ae6110a1d3fbd8c000ec86586",
      owner_name: "info-zooma",
      app_name: options[:app_name],
      file: apk_path,
      mapping: mapping_path,
      destinations: "Collaborators,Testers",
      notify_testers: false
    )
  end


  #############################################
  ### Staging
  #############################################
  desc "IMPEL - Staging - Create APK file"
  private_lane :impel_staging_apk do
    gradle(
      task: ":app:assembleStaging"
    )
  end

  desc "IMPEL - Staging - Create apk file and upload to App Center"
  lane :impel_staging_upload_appcenter do
    impel_staging_apk
    upload_appcenter(app_name: @impelStagingAppcenterName)
    notification(subtitle: "Android Impel Staging", message: "Uploaded to AppCenter")

  end


  #############################################
  ### Release
  #############################################
  desc "IMPEL - Release - Create APK file"
  private_lane :impel_release_apk do
    gradle(
      task: ":app:assembleRelease"
    )
  end

  desc "IMPEL - Release - Create apk file and upload to App Center"
  lane :impel_release_upload_appcenter do
    impel_release_apk
    upload_appcenter(app_name: @impelReleaseAppcenterName)
    notification(subtitle: "Android Impel Release", message: "Uploaded to AppCenter")
  end

  lane :test_slack do
    slack(
      message: "Android Impel Release uploaded to AppCenter",
      success: true,
      slack_url: "https://hooks.slack.com/services/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",
      default_payloads: [],
      fail_on_error: false,
      # payload: {
      #   "Platform" => "Android",
      #   "Variant" => "Release",
      #   "Store" => "AppCenter"
      # }
      attachment_properties: {
        fields: [
          {
            "title": "Platform",
            "value": "Android",
            "short": true
          },
          {
            "title": "Variant",
            "value": "Release",
            "short": true
          },
          {
            "title": "Store",
            "value": "AppCenter",
            "short": true
          }
        ]
      }
    )
  end

  error do |lane, exception|
    notification(subtitle: "Fastlane Error", message: "Open terminal for more info")
  end
end

`./fastlane/Appfile`
json_key_file("") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one
package_name("") # e.g. com.krausefx.app

fastlane gems

Gem Version Update-Status
fastlane 2.170.0 ✅ Up-To-Date

Loaded fastlane plugins:

Plugin Version Update-Status
fastlane-plugin-appcenter 1.11.0 ✅ Up-To-Date
Loaded gems
Gem Version
did_you_mean 1.4.0
slack-notifier 2.3.2
rouge 2.0.7
xcpretty 0.3.0
terminal-notifier 2.0.0
terminal-table 1.8.0
plist 3.5.0
public_suffix 2.0.5
addressable 2.7.0
multipart-post 2.0.0
word_wrap 1.0.0
babosa 1.0.3
colored 1.2
highline 1.7.10
commander-fastlane 4.4.6
excon 0.73.0
unf_ext 0.0.7.6
unf 0.1.4
domain_name 0.5.20190701
http-cookie 1.0.3
faraday-cookie_jar 0.0.6
ruby2_keywords 0.0.2
faraday 1.1.0
faraday_middleware 1.0.0
fastimage 2.1.7
gh_inspector 1.1.3
rubyzip 2.3.0
security 0.1.3
xcpretty-travis-formatter 1.0.0
dotenv 2.7.5
jwt 2.1.0
uber 0.1.0
declarative 0.0.10
declarative-option 0.1.0
representable 3.0.4
retriable 3.1.2
mini_mime 1.0.2
os 1.0.1
googleauth 0.11.0
httpclient 2.8.3
google-api-client 0.38.0
emoji_regex 1.0.1
jmespath 1.4.0
aws-partitions 1.288.0
aws-eventstream 1.0.3
aws-sigv4 1.1.1
aws-sdk-core 3.92.0
aws-sdk-kms 1.30.0
aws-sdk-s3 1.61.1
uri 0.10.0
nanaimo 0.2.6
colored2 3.1.2
claide 1.0.3
CFPropertyList 3.0.2
atomos 0.1.3
xcodeproj 1.15.0
unicode-display_width 1.7.0
tty-screen 0.7.1
tty-cursor 0.7.1
tty-spinner 0.9.3
json 2.3.0
mini_magick 4.10.1
bundler 2.1.2
naturally 2.2.0
simctl 1.6.8
multi_json 1.15.0
signet 0.13.2
memoist 0.16.2
digest-crc 0.5.1
google-cloud-errors 1.0.0
google-cloud-env 1.3.1
google-cloud-core 1.5.0
google-cloud-storage 1.25.1
forwardable 1.3.1
logger 1.4.2
cgi 0.1.0
timeout 0.1.0
stringio 0.1.0
ipaddr 1.2.2
openssl 2.1.2
ostruct 0.2.0
strscan 1.0.3
date 3.0.0
delegate 0.1.0
fileutils 1.4.1
io-console 0.5.3
zlib 1.1.0
singleton 0.1.0
rexml 3.2.3
open3 0.1.0
yaml 0.1.0
psych 3.1.0
mutex_m 0.1.0
webrick 1.6.0
fastlane-plugin-appcenter 1.11.0
csv 3.1.2

generated on: 2020-12-16

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 5
  • Comments: 21

Most upvoted comments

I would still like this

I would still like this

I would still like this