Http

Posts a payload to an HTTP/HTTPS server.

Legend:

  • required

  • optional

  • may use environment variable

  • accepts Name Templates

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

announce:
  # 
  http:

    # A name is required.
    # 
    myHttp:

      # Enable or disable this announcer.
      # 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 `http`, i.e, `httpFoo`.
        foo: bar

      # URL of the HTTP/HTTPS server.
      #  
      url: https://my.server.com/announcements

      # The username required for authorization.
      # If left unspecified, the `JRELEASER_HTTP_${name}_USERNAME`
      # environment variable must be defined.
      #  
      username: __DO_NOT_SET_HERE__

      # Password for login into the repository.
      # If left unspecified, the `JRELEASER_HTTP_${name}_PASSWORD`
      # environment variable must be defined.
      #  
      password: __DO_NOT_SET_HERE__

      # The authorization method to use.
      # Supported values are [`NONE`, `BASIC`, `BEARER`].
      # `Basic` requires both username & password.
      # `BEARER` requires a token (set as password).
      # Defaults to `NONE`.
      # 
      authorization: BASIC

      # Keyword to use when authentication is set to `BEARER`.
      # Defaults to `Bearer`.
      # 
      beaerKeyword: Token

      # The method to use for sending the payload.
      # Supported values are [`POST`, `PUT`].
      # Defaults to `PUT`.
      # 
      method: POST

      # Additional headers to be sent to the server.
      # Values accept Name Templates.
      #  
      headers:
        'Accept': 'text/plain'
        'Content-Type': 'text/plain'

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

      # Path to a template file that contains the payload.
      # Review the available Name Templates.
      # Defaults to `src/jreleaser/templates/http/myHttp.tpl`.
      # 
      payloadTemplate: path/to/template/myHttp.tpl
# A name is required.
# 
[announce.http.myHttp]

  # Enable or disable this announcer.
  # 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 `http`, i.e, `httpFoo`.

  # URL of the HTTP/HTTPS server.
  #  
  url = "https://my.server.com/announcements"

  # The username required for authorization.
  # If left unspecified, the `JRELEASER_HTTP_${name}_USERNAME`
  # environment variable must be defined.
  #  
  username = "__DO_NOT_SET_HERE__"

  # Password for login into the repository..
  # If left unspecified, the `JRELEASER_HTTP_${name}_PASSWORD`
  # environment variable must be defined.
  #  
  password = "__DO_NOT_SET_HERE__"

  # The authorization method to use.
  # Supported values are [`NONE`, `BASIC`, `BEARER`].
  # `Basic` requires both username & password.
  # `BEARER` requires a token (set as password).
  # Defaults to `NONE`.
  # 
  authorization = "BASIC"

  # Keyword to use when authentication is set to `BEARER`.
  # Defaults to `Bearer`.
  # 
  beaerKeyword = "Token"

  # The method to use for sending the payload.
  # Supported values are [`POST`, `PUT`].
  # Defaults to `PUT`.
  # 
  method = "POST"

  # Additional headers to be sent to the server.
  # Values accept Name Templates.
  #  
  headers."Accept" = "text/plain"
  headers."Content-Type" = "text/plain"

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

  # Path to a template file that contains the payload.
  # Review the available Name Templates.
  # Defaults to `src/jreleaser/templates/http/myHttp.tpl`.
  # 
  payloadTemplate = "path/to/template/myHttp.tpl"
{
  "announce": {
    // 
    "http": {

      // A name is required.
      // 
      "myHttp": {

        // Enable or disable this announcer.
        // 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 `http`, i.e, `httpFoo`.
          "foo": "bar"
        },

        // URL of the HTTP/HTTPS server.
        //  
        "url": "https://my.server.com/announcements",

        // The username required for authorization.
        // If left unspecified, the `JRELEASER_HTTP_${name}_USERNAME`
        // environment variable must be defined.
        //  
        "username": "__DO_NOT_SET_HERE__",

        // Password for login into the repository.
        // If left unspecified, the `JRELEASER_HTTP_${name}_PASSWORD`
        // environment variable must be defined.
        //  
        "password": "__DO_NOT_SET_HERE__",

        // The authorization method to use.
        // Supported values are [`NONE`, `BASIC`, `BEARER`].
        // `Basic` requires both username & password.
        // `BEARER` requires a token (set as password).
        // Defaults to `NONE`.
        // 
        "authorization": "BASIC",

        // Keyword to use when authentication is set to `BEARER`.
        // Defaults to `Bearer`.
        // 
        "beaerKeyword": "Token",

        // The method to use for sending the payload.
        // Supported values are [`POST`, `PUT`].
        // Defaults to `PUT`.
        // 
        "method": "POST",

        // Additional headers to be sent to the server.
        // Values accept Name Templates.
        //  
        "headers": {
          "Accept": "text/plain",
          "Content-Type": "text/plain"
        }

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

        // Path to a template file that contains the payload.
        // Review the available Name Templates.
        // Defaults to `src/jreleaser/templates/http/myHttp.tpl`.
        // 
        "payloadTemplate": "path/to/template/myHttp.tpl"
      }
    }
  }
}
<jreleaser>
  <!--
    
  -->
  <announce>
    <!--
      
    -->
    <http>

      <!--
        A name is required.
        
       -->
      <myHttp>

        <!--
          Enable or disable this announcer.
          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 `http`, i.e, `httpFoo`.
          -->
          <foo>bar</foo>
        </extraProperties>

        <!--
          URL of the HTTP/HTTPS server + path + artifact.
           
        -->
        <url>https://my.server.com/announcements</url>

        <!--
          The username required for authorization.
          If left unspecified, the `JRELEASER_HTTP_${name}_USERNAME`
          environment variable must be defined.
           
        -->
        <username>__DO_NOT_SET_HERE__</username>

        <!--
          Password for login into the repository.
          If left unspecified, the `JRELEASER_HTTP_${name}_PASSWORD`
          environment variable must be defined.
           
        -->
        <password>__DO_NOT_SET_HERE__</password>

        <!--
          The authorization method to use.
          Supported values are [`NONE`, `BASIC`, `BEARER`].
          `Basic` requires both username & password.
          `BEARER` requires a token (set as password).
          Defaults to `NONE`.
          
        -->
        <authorization>BASIC</authorization>

        <!--
          Keyword to use when authentication is set to `BEARER`.
          Defaults to `Bearer`.
          
        -->
        <beaerKeyword>Token</beaerKeyword>

        <!--
          The method to use for sending the payload.
          Supported values are [`POST`, `PUT`].
          Defaults to `PUT`.
          
        -->
        <method>POST</method>

        <!--
          Additional headers to be sent to the server.
          Values accept Name Templates.
           
        -->
        <headers>
          <Accept>text/plain</Accept>
          <Content-Type>text/plain</Content-Type>
        </headers>

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

        <!--
          Path to a template file that contains the payload.
          Review the available Name Templates.
          Defaults to `src/jreleaser/templates/http/myHttp.tpl`.
          
        -->
        <payloadTemplate>path/to/template/myHttp.tpl</payloadTemplate>
      </myHttp>
    </http>
  </announce>
</jreleaser>
jreleaser {
  announce {
    // 
    http {

      // A name is required.
      // 
      myHttp {

        // Enable or disable this announcer.
        // 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 `http`, i.e, `httpFoo`.
        //  
        extraProperties.put('foo', 'bar')

        // URL of the HTTP/HTTPS server.
        //  
        url = 'https://my.server.com/announcements'

        // The username required for authorization.
        // If left unspecified, the `JRELEASER_HTTP_${name}_USERNAME`
        // environment variable must be defined.
        //  
        username = '__DO_NOT_SET_HERE__'

        // Password for login into the repository.
        // If left unspecified, the `JRELEASER_HTTP_${name}_PASSWORD`
        // environment variable must be defined.
        //  
        password = '__DO_NOT_SET_HERE__'

        // The authorization method to use.
        // Supported values are [`NONE`, `BASIC`, `BEARER`].
        // `Basic` requires both username & password.
        // `BEARER` requires a token (set as password).
        // Defaults to `NONE`.
        // 
        authorization = 'BASIC'

        // Keyword to use when authentication is set to `BEARER`.
        // Defaults to `Bearer`.
        // 
        beaerKeyword = 'Token'

        // The method to use for sending the payload.
        // Supported values are [`POST`, `PUT`].
        // Defaults to `PUT`.
        // 
        method = 'POST'

        // Additional headers to be sent to the server.
        // Values accept Name Templates.
        //  
        headers.put('Accept', 'text/plain')
        headers.put('Content-Type', 'text/plain')

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

        // Path to a template file that contains the payload.
        // Review the available Name Templates.
        // Defaults to `src/jreleaser/templates/http/myHttp.tpl`.
        // 
        payloadTemplate = 'path/to/template/myHttp.tpl'
      }
    }
  }
}

You may define either payload or payloadTemplate, with the former taking precedence over the latter.

Templates

The default location for templates is:

src/jreleaser/templates/http

Examples

XWiki

Assuming credentials are stored in the following environment variables:

  • JRELEASER_HTTP_XWIKI_USERNAME

  • JRELEASER_HTTP_XWIKI_PASSWORD

jreleaser.yml

announce:
  http:
    xwiki:
      active: ALWAYS
      url: 'http://xwiki.acme.com/xwiki/rest/wikis/xwiki/spaces/{{httpSpaceName}}/pages/{{httpPageName}}'
      authorization: BASIC
      method: PUT
      headers:
        Accept: text/xml
        Content-Type: text/xml
      extraProperties:
        spaceName: Releases
        pageName: '{{projectName}} {{tagName}}'

src/jreleaser/templates/http/xwiki.tpl

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<page xmlns="http://www.xwiki.org">
    <name>{{httpPageName}}</name>
    <title>{{httpPageName}}</title>
    <author>XWiki.user</author>
    <authorName>XWiki.user</authorName>
    <majorVersion>0</majorVersion>
    <minorVersion>0</minorVersion>
    <hidden>false</hidden>
    <syntax>xwiki/2.0</syntax>
    <comment>{{projectName}} {{tagName}}</comment>
    <content>
    🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}
    </content>
</page>
Values for httpSpaceName and httpPageName are defined as extra properties.

Confluence

Assuming credentials are stored in the following environment variables:

  • JRELEASER_HTTP_CONFLUENCE_USERNAME

  • JRELEASER_HTTP_CONFLUENCE_PASSWORD

jreleaser.yml

announce:
  http:
    confluence:
      active: ALWAYS
      url: 'https://confluence.acme.com/wiki/rest/api/content'
      authorization: BASIC
      headers:
        Accept: application/json
        Content-Type: application/json
      extraProperties:
        spaceName: Releases
        pageName: '{{projectName}} {{tagName}}'

src/jreleaser/templates/http/confluence.tpl

{
  "type": "page",
  "title": "{{httpPageName}}",
  "space": {
    "key": "{{httpSpaceName}}"
  },
  "body": {
    "storage": {
      "value": "🚀 {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}",
      "representation": "storage"
    }
  }
}