Webhooks

Posts a message to a service that supports incoming webhooks.

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

Legend:

  • required

  • optional

  • may use environment variable

  • accepts Name Templates

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

announce:
  # 
  webhooks:

    # Webhooks require a name.
    # 
    myWebhook:

      # Enable or disable this announcer.
      # Valid 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: 6

      # The webhook associated with a specific Gitter room.
      # If left unspecified, the `JRELEASER_${name}_WEBHOOK`
      # environment variable must be defined.
      #  
      webhook: __DO_NOT_SET_HERE__

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

      # The name of the JSON property that contains the message.
      # Defaults to `text`.
      # Ignored if `messageTemplate` is used.
      # 
      messageProperty: text

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

      # Additional properties used when evaluating templates.
      #  
      extraProperties:
        # Key will be capitalized and prefixed with `webhook`, i.e, `webhookFoo`.
        foo: bar
# Webhooks require a name.
# 
[announce.webhooks.myWebhook]

  # Enable or disable this announcer.
  # Valid 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

  # The webhook associated with a specific Gitter room.
  # If left unspecified, the `JRELEASER_${name}_WEBHOOK`
  # environment variable must be defined.
  #  
  webhook = "__DO_NOT_SET_HERE__"

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

  # The name of the JSON property that contains the message.
  # Defaults to `text`.
  # Ignored if `messageTemplate` is used.
  # 
  messageProperty = "text"

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

  # Additional properties used when evaluating templates.
  #  
  extraProperties.foo = "bar"
  # Key will be capitalized and prefixed with `webhook`, i.e, `webhookFoo`.
{
  "announce": {
    // 
    "webhooks": {

      // Webhooks require a name.
      // 
      "myWebhook": {

        // Enable or disable this announcer.
        // Valid 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,

        // The webhook associated with a specific Gitter room.
        // If left unspecified, the `JRELEASER_${name}_WEBHOOK`
        // environment variable must be defined.
        //  
        "webhook": "__DO_NOT_SET_HERE__",

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

        // The name of the JSON property that contains the message.
        // Defaults to `text`.
        // Ignored if `messageTemplate` is used.
        // 
        "messageProperty": "text",

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

        // Additional properties used when evaluating templates.
        //  
        "extraProperties": {
          // Key will be capitalized and prefixed with `webhook`, i.e, `webhookFoo`.
          "foo": "bar"
        }
      }
    }
  }
}
<jreleaser>
  <!--
    
  -->
  <announce>
    <!--
      
    -->
    <webhooks>

      <!--
        Webhooks require a name.
        
       -->
      <myWebhook>

        <!--
          Enable or disable this announcer.
          Valid 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>

        <!--
          The webhook associated with a specific Gitter room.
          If left unspecified, the `JRELEASER_${name}_WEBHOOK` environment variable must be defined.
           
        -->
        <webhook>__DO_NOT_SET_HERE__</webhook>

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

        <!--
          The name of the JSON property that contains the message.
          Defaults to `text`.
          Ignored if `messageTemplate` is used.
          
        -->
        <messageProperty>text</messageProperty>

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

        <!--
          Additional properties used when evaluating templates.
           
        -->
        <extraProperties>
          <!--
            Key will be capitalized and prefixed with `webhook`, i.e, `webhookFoo`.
          -->
          <foo>bar</foo>
        </extraProperties>
      </myWebhook>
    </webhooks>
  </announce>
</jreleaser>
jreleaser {
  announce {
    // 
    webhooks {

      // Webhooks require a name.
      // 
      myWebhook {

        // Enable or disable this announcer.
        // Valid 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

        // The webhook associated with a specific Gitter room.
        // If left unspecified, the `JRELEASER_${name}_WEBHOOK`
        // environment variable must be defined.
        //  
        webhook = '__DO_NOT_SET_HERE__'

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

        // The name of the JSON property that contains the message.
        // Defaults to `text`.
        // Ignored if `messageTemplate` is used.
        // 
        messageProperty = 'text'

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

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

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

The template file may be initialized using the template command.