Discord

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

  1. Log into the target discord server.

  2. Select the channel you want to integrate to, click on its settings icon.

  3. Click on the Integrations menu item.

  4. Click on Webhooks.

  5. Create a new webhook.

  6. Copy the generated webhook URL.

Webhooks are not protected, anyone with access to the webhook URI can send messages to the target room. Prefer setting the JRELEASER_DISCORD_WEBHOOK 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:
  # 
  discord:
    # Enables or disables discord.
    # 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

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

    # The webhook associated with a specific Discord room.
    # If left unspecified, the `JRELEASER_DISCORD_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}}'

    # Path to a template file that contains the message.
    # Review the available Name Templates.
    # Defaults to `src/jreleaser/templates/discord.tpl`.
    # 
    messageTemplate: path/to/template/discord.tpl
# 
[announce.discord]
  # Enables or disables discord.
  # 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

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

  # The webhook associated with a specific Discord room.
  # If left unspecified, the `JRELEASER_DISCORD_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}}"

  # Path to a template file that contains the message.
  # Review the available Name Templates.
  # Defaults to `src/jreleaser/templates/discord.tpl`.
  # 
  messageTemplate = "path/to/template/discord.tpl"
{
  // 
  "announce": {
    // 
    "discord": {
      // Enables or disables discord.
      // 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,

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

      // The webhook associated with a specific Discord room.
      // If left unspecified, the `JRELEASER_DISCORD_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}}",

      // Path to a template file that contains the message.
      // Review the available Name Templates.
      // Defaults to `src/jreleaser/templates/discord.tpl`.
      // 
      "messageTemplate": "path/to/template/discord.tpl"
    }
  }
}
<jreleaser>
  <!--
    
  -->
  <announce>
    <!--
      
    -->
    <discord>
      <!--
        Enables or disables discord.
        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>

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

      <!--
        The webhook associated with a specific Discord room.
        If left unspecified, the `JRELEASER_DISCORD_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>

      <!--
        Path to a template file that contains the message.
        Review the available Name Templates.
        Defaults to `src/jreleaser/templates/discord.tpl`.
        
      -->
      <messageTemplate>path/to/template/discord.tpl</messageTemplate>
    </discord>
  </announce>
</jreleaser>
jreleaser {
  // 
  announce {
    // 
    discord {
      // Enables or disables discord.
      // 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

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

      // The webhook associated with a specific Discord room.
      // If left unspecified, the `JRELEASER_DISCORD_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}}'

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

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.