Discourse

Posts a message to a Discourse server. You must procure a username and apiKey to use this announcer.

Configuration

Legend:

  • required

  • optional

  • may use environment variable

  • accepts Name Templates

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

# 
announce:
  # 
  discourse:
    # Enables or disables Discourse.
    # 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 `discourse`, i.e, `discourseFoo`.
      foo: bar

    # The Discourse server endpoint.
    # 
    host: https://my.discourseserver.com

    # The Discourse username to use.
    # If left unspecified, the `JRELEASER_DISCOURSE_USERNAME`
    # environment variable must be defined.
    #  
    username: duke

    # The ApiKey associated with the given username.
    # If left unspecified, the `JRELEASER_DISCOURSE_API_KEY`
    # environment variable must be defined.
    #  
    apiKey: __USE_ENVIRONMENT_VARIABLE__

    # The categoryName where the message will be sent to
    # If left unspecified, the `JRELEASER_DISCOURSE_CATEGORY_NAME`
    # environment variable must be defined.
    #  
    categoryName: announce

    # The message's title.
    # Review the available Name Templates.
    #  
    title: '{{projectNameCapitalized}} {{projectVersion}} released!'

    # 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/discourse.tpl`.
    # 
    messageTemplate: path/to/template/discourse.tpl
# 
[announce.discourse]
  # Enables or disables Discourse.
  # 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 `discourse`, i.e, `discourseFoo`.

  # The Discourse server endpoint.
  # 
  host = "https://my.discourseserver.com"

  # The Discourse username to use.
  # If left unspecified, the `JRELEASER_DISCOURSE_USERNAME`
  # environment variable must be defined.
  #  
  username = "duke"

  # The ApiKey associated with the given username.
  # If left unspecified, the `JRELEASER_DISCOURSE_API_KEY`
  # environment variable must be defined.
  #  
  apiKey = "__USE_ENVIRONMENT_VARIABLE__"

  # The categoryName where the message will be sent to
  # If left unspecified, the `JRELEASER_DISCOURSE_CATEGORY_NAME`
  # environment variable must be defined.
  #  
  categoryName = "announce"

  # The message's title.
  # Review the available Name Templates.
  #  
  title = "{{projectNameCapitalized}} {{projectVersion}} released!"

  # 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/discourse.tpl`.
  # 
  messageTemplate = "path/to/template/discourse.tpl"
{
  // 
  "announce": {
    // 
    "discourse": {
      // Enables or disables Discourse.
      // 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 `discourse`, i.e, `discourseFoo`.
        "foo": "bar"
      },

      // The Discourse server endpoint.
      // 
      "host": "https://my.discourseserver.com",

      // The Discourse username to use.
      // If left unspecified, the `JRELEASER_DISCOURSE_USERNAME`
      // environment variable must be defined.
      //  
      "username": "duke",

      // The ApiKey associated with the given username.
      // If left unspecified, the `JRELEASER_DISCOURSE_API_KEY`
      // environment variable must be defined.
      //  
      "apiKey": "__USE_ENVIRONMENT_VARIABLE__",

      // The categoryName where the message will be sent to
      // If left unspecified, the `JRELEASER_DISCOURSE_CATEGORY_NAME`
      // environment variable must be defined.
      //  
      "categoryName": "announce",

      // The message's title.
      // Review the available Name Templates.
      // 
      "title": "{{projectNameCapitalized}} {{projectVersion}} released!",

      // 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/discourse.tpl`.
      // 
      "messageTemplate": "path/to/template/discourse.tpl"
    }
  }
}
<jreleaser>
  <!--
    
  -->
  <announce>
    <!--
      
    -->
    <discourse>
      <!--
        Enables or disables Discourse.
        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 `discourse`, i.e, `discourseFoo`.
        -->
        <foo>bar</foo>
      </extraProperties>

      <!--
        The Discourse server endpoint.
        
      -->
      <host>https://my.discourseserver.com</host>

      <!--
        The Discourse username to use.
        If left unspecified, the `JRELEASER_DISCOURSE_USERNAME`
        environment variable must be defined.
         
      -->
      <username>duke</username>

      <!--
        The ApiKey associated with the given username.
        If left unspecified, the `JRELEASER_DISCOURSE_API_KEY`
        environment variable must be defined.
         
      -->
      <apiKey>__USE_ENVIRONMENT_VARIABLE__</apiKey>

      <!--
        The categoryName where the message will be sent to
        If left unspecified, the `JRELEASER_DISCOURSE_CATEGORY_NAME`
        environment variable must be defined.
         
      -->
      <categoryName>announce</categoryName>

      <!--
        The message's title.
        Review the available Name Templates.
        
      -->
      <title>{{projectNameCapitalized}} {{projectVersion}} released!</title>

      <!--
        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/discourse.tpl`.
        
      -->
      <messageTemplate>path/to/template/discourse.tpl</messageTemplate>
    </discourse>
  </announce>
</jreleaser>
jreleaser {
  // 
  announce {
    // 
    discourse {
      // Enables or disables Discourse.
      // 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 `discourse`, i.e, `discourseFoo`.
      //  
      extraProperties.put('foo', 'bar')

      // The Discourse server endpoint.
      // 
      host = 'https://my.discourseserver.com'

      // The Discourse username to use.
      // If left unspecified, the `JRELEASER_DISCOURSE_USERNAME`
      // environment variable must be defined.
      //  
      username = 'duke'

      // The ApiKey associated with the given username.
      // If left unspecified, the `JRELEASER_DISCOURSE_API_KEY`
      // environment variable must be defined.
      //  
      apiKey = '__USE_ENVIRONMENT_VARIABLE__'

      // The categoryName where the message will be sent to
      // If left unspecified, the `JRELEASER_DISCOURSE_CATEGORY_NAME`
      // environment variable must be defined.
      //  
      categoryName = 'announce'

      // The message's title.
      // Review the available Name Templates.
      // 
      title = '{{projectNameCapitalized}} {{projectVersion}} released!'

      // 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/discourse.tpl`.
      // 
      messageTemplate = 'path/to/template/discourse.tpl'
    }
  }
}

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.discourse.active

JRELEASER_ANNOUNCE_DISCOURSE_ACTIVE

username

jreleaser.announce.discourse.username
jreleaser.discourse.username

JRELEASER_ANNOUNCE_DISCOURSE_USERNAME
JRELEASER_DISCOURSE_USERNAME

apiKey

jreleaser.announce.discourse.api.key
jreleaser.discourse.api.key

JRELEASER_ANNOUNCE_DISCOURSE_API_KEY
JRELEASER_DISCOURSE_API_KEY

category

jreleaser.announce.discourse.category
jreleaser.discourse.category

JRELEASER_ANNOUNCE_DISCOURSE_CATEGORY
JRELEASER_DISCOURSE_CATEGORY

Templates

The default location for templates is:

src/jreleaser/templates

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

  • discourse.tpl

Templates may be initialized using the template command