Mattermost

This announcer has been deprecated in v1.4.0 and will be removed in v2.0.0. Use Webhooks instead as shown here.

Posts a message to a Mattermost room. You must create a custom webhook for this announcer to work.

Webhooks are not protected, anyone with access to the webhook URI can send messages to the target room. Prefer setting the JRELEASER_MATTERMOST_WEBHOOK environment variable over explicitly setting a value in the configuration DSL.

Configuration

Legend:

  • required

  • optional

  • may use environment variable

  • accepts Name Templates

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

# 
announce:
  # 
  mattermost:
    # Enables or disables Mattermost.
    # Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
    # Defaults to `NEVER`.
    #  
    active: ALWAYS

    # Defines the connection timeout in seconds.
    # Defaults to `20`.
    # 
    connectTimeout: 20

    # Defines the read timeout in seconds.
    # Defaults to `60`.
    # 
    readTimeout: 60

    # Additional properties used when evaluating templates.
    #  
    extraProperties:
      # Key will be capitalized and prefixed with `mattermost`, i.e, `mattermostFoo`.
      foo: bar

    # The webhook associated with a specific Mattermost room.
    #  
    webhook: __USE_ENVIRONMENT_VARIABLE__

    # The announcement message.
    # Review the available Name Templates.
    #  
    message: '🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}'

    # Path to a template file that contains the message.
    # Review the available Name Templates.
    # Defaults to `src/jreleaser/templates/mattermost.tpl`.
    # 
    messageTemplate: path/to/template/mattermost.tpl

    # Whether to send the payload as is or wrap it with a `text:` property.
    # Defaults to `true`.
    # 
    structuredMessage: false
# 
[announce.mattermost]
  # Enables or disables Mattermost.
  # Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
  # Defaults to `NEVER`.
  #  
  active = "ALWAYS"

  # Defines the connection timeout in seconds.
  # Defaults to `20`.
  # 
  connectTimeout = 20

  # Defines the read timeout in seconds.
  # Defaults to `60`.
  # 
  readTimeout = 60

  # Additional properties used when evaluating templates.
  #  
  extraProperties.foo = "bar"
  # Key will be capitalized and prefixed with `mattermost`, i.e, `mattermostFoo`.

  # The webhook associated with a specific Mattermost room.
  #  
  webhook = "__USE_ENVIRONMENT_VARIABLE__"

  # The announcement message.
  # Review the available Name Templates.
  #  
  message = "🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}"

  # Path to a template file that contains the message.
  # Review the available Name Templates.
  # Defaults to `src/jreleaser/templates/mattermost.tpl`.
  # 
  messageTemplate = "path/to/template/mattermost.tpl"

  # Whether to send the payload as is or wrap it with a `text:` property.
  # Defaults to `true`.
  # 
  structuredMessage = false
{
  // 
  "announce": {
    // 
    "mattermost": {
      // Enables or disables Mattermost.
      // Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
      // Defaults to `NEVER`.
      //  
      "active": "ALWAYS",

      // Defines the connection timeout in seconds.
      // Defaults to `20`.
      // 
      "connectTimeout": 20,

      // Defines the read timeout in seconds.
      // Defaults to `60`.
      // 
      "readTimeout": 60,

      // Additional properties used when evaluating templates.
      //  
      "extraProperties": {
        // Key will be capitalized and prefixed with `mattermost`, i.e, `mattermostFoo`.
        "foo": "bar"
      },

      // The webhook associated with a specific Mattermost room.
      //  
      "webhook": "__USE_ENVIRONMENT_VARIABLE__",

      // The announcement message.
      // Review the available Name Templates.
      //  
      "message": "🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}",

      // Path to a template file that contains the message.
      // Review the available Name Templates.
      // Defaults to `src/jreleaser/templates/mattermost.tpl`.
      // 
      "messageTemplate": "path/to/template/mattermost.tpl",

      // Whether to send the payload as is or wrap it with a `text:` property.
      // Defaults to `true`.
      // 
      "structuredMessage": false
    }
  }
}
<jreleaser>
  <!--
    
  -->
  <announce>
    <!--
      
    -->
    <mattermost>
      <!--
        Enables or disables Mattermost.
        Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
        Defaults to `NEVER`.
         
      -->
      <active>ALWAYS</active>

      <!--
        Defines the connection timeout in seconds.
        Defaults to `20`.
        
      -->
      <connectTimeout>20</connectTimeout>

      <!--
        Defines the read timeout in seconds.
        Defaults to `60`.
        
      -->
      <readTimeout>60</readTimeout>

      <!--
        Additional properties used when evaluating templates.
         
      -->
      <extraProperties>
        <!--
          Key will be capitalized and prefixed with `mattermost`, i.e, `mattermostFoo`.
        -->
        <foo>bar</foo>
      </extraProperties>

      <!--
        The webhook associated with a specific Mattermost room.
         
      -->
      <webhook>__USE_ENVIRONMENT_VARIABLE__</webhook>

      <!--
        The announcement message.
        Review the available Name Templates.
         
      -->
      <message>🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}</message>

      <!--
        Path to a template file that contains the message.
        Review the available Name Templates.
        Defaults to `src/jreleaser/templates/mattermost.tpl`.
        
      -->
      <messageTemplate>path/to/template/mattermost.tpl</messageTemplate>

      <!--
        Whether to send the payload as is or wrap it with a `text:` property.
        Defaults to `true`.
        
      -->
      <structuredMessage>false</structuredMessage>
    </mattermost>
  </announce>
</jreleaser>
jreleaser {
  // 
  announce {
    // 
    mattermost {
      // Enables or disables Mattermost.
      // Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
      // Defaults to `NEVER`.
      //  
      active = 'ALWAYS'

      // Defines the connection timeout in seconds.
      // Defaults to `20`.
      // 
      connectTimeout = 20

      // Defines the read timeout in seconds.
      // Defaults to `60`.
      // 
      readTimeout = 60

      // Additional properties used when evaluating templates.
      // Key will be capitalized and prefixed with `mattermost`, i.e, `mattermostFoo`.
      //  
      extraProperties.put('foo', 'bar')

      // The webhook associated with a specific Mattermost room.
      //  
      webhook = '__USE_ENVIRONMENT_VARIABLE__'

      // The announcement message.
      // Review the available Name Templates.
      //  
      message = '🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}'

      // Path to a template file that contains the message.
      // Review the available Name Templates.
      // Defaults to `src/jreleaser/templates/mattermost.tpl`.
      // 
      messageTemplate = 'path/to/template/mattermost.tpl'

      // Whether to send the payload as is or wrap it with a `text:` property.
      // Defaults to `true`.
      // 
      structuredMessage = false
    }
  }
}

You may define either message or messageTemplate, with the former taking precedence over the latter.

Environment

When not explicitly set, the value of the following properties may be resolved from an environment variable or a system property as shown in the table. The system property takes precedence over the environment variable.

System Property Environment Variable

active

jreleaser.announce.mattermost.active

JRELEASER_ANNOUNCE_MATTERMOST_ACTIVE

webhook

jreleaser.announce.mattermost.webhook
jreleaser.mattermost.webhook

JRELEASER_ANNOUNCE_MATTERMOST_WEBHOOK
JRELEASER_MATTERMOST_WEBHOOK

Templates

The default location for templates is:

src/jreleaser/templates

The following list shows the filenames that may be used to override default templates:

  • mattermost.tpl

Templates may be initialized using the template command