Http
Posts a payload to an HTTP/HTTPS server.
Configuration
Legend:
-
required
-
optional
-
may use environment variable
-
accepts Name Templates
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.
#
username: __USE_ENVIRONMENT_VARIABLE__
# Password for login into the repository.
#
password: __USE_ENVIRONMENT_VARIABLE__
# 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`.
#
bearerKeyword: 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.
#
username = "__USE_ENVIRONMENT_VARIABLE__"
# Password for login into the repository.
#
password = "__USE_ENVIRONMENT_VARIABLE__"
# 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`.
#
bearerKeyword = "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.
//
"username": "__USE_ENVIRONMENT_VARIABLE__",
// Password for login into the repository.
//
"password": "__USE_ENVIRONMENT_VARIABLE__",
// 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`.
//
"bearerKeyword": "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.
-->
<username>__USE_ENVIRONMENT_VARIABLE__</username>
<!--
Password for login into the repository.
-->
<password>__USE_ENVIRONMENT_VARIABLE__</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`.
-->
<bearerKeyword>Token</bearerKeyword>
<!--
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.
//
username = '__USE_ENVIRONMENT_VARIABLE__'
// Password for login into the repository.
//
password = '__USE_ENVIRONMENT_VARIABLE__'
// 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`.
//
bearerKeyword = '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.
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.http.${name}.active |
JRELEASER_ANNOUNCE_HTTP_${name}_ACTIVE |
username |
|
jreleaser.announce.http.${name}.username |
JRELEASER_ANNOUNCE_HTTP_${name}_USERNAME |
password |
|
jreleaser.announce.http.${name}.password |
JRELEASER_ANNOUNCE_HTTP_${name}_PASSWORD |
Substitute ${name} for the value of the named instance. |
Space (' '), underscore (_
), and dash (-
) will be replaced by dot (.
) to separate tokens in the System property.
Space (' '), dash (-
), and dot (.
) will be replaced by underscore (_
) to separate tokens in the environment variable,
such that:
${name} | System Property | Environment Variable |
---|---|---|
foobar |
|
|
fooBar |
|
|
foo bar |
|
|
foo-bar |
|
|
foo_bar |
|
|
foo.bar |
|
|
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"
}
}
}