Document discord

This commit is contained in:
Andres Almiray
2021-04-19 23:10:28 +02:00
parent 2284cb1a03
commit c62777abba
3 changed files with 264 additions and 0 deletions

View File

@@ -19,6 +19,7 @@
* xref:distributions.adoc[]
* xref:files.adoc[]
* xref:announce/index.adoc[]
** xref:announce/discord.adoc[]
** xref:announce/discussions.adoc[]
** xref:announce/gitter.adoc[]
** xref:announce/mail.adoc[]

View File

@@ -0,0 +1,255 @@
= Discord
Posts a message to a link:https://discord.im/[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.
IMPORTANT: 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.
include::partial$legend.adoc[]
[tabs]
====
YAML::
+
[source,yaml]
[subs="+macros"]
----
announce:
# icon:dot-circle[]
discord:
# Enable or disable this announcer.
# Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
# Defaults to `NEVER`.
# icon:dot-circle[]
active: ALWAYS
# Defines the connection timeout in seconds.
# Defaults to `20`.
# icon:dot-circle[]
connectTimeout: 20
# Defines the read timeout in seconds.
# Defaults to `60`.
# icon:dot-circle[]
readTimeout: 6
# The webhook associated with a specific Discord room.
# If left unspecified, the `JRELEASER_DISCORD_WEBHOOK`
# environment variable must be defined.
# icon:exclamation-triangle[] icon:eye-slash[]
webhook: __DO_NOT_SET_HERE__
# The announcement message.
# Review the available xref:configuration:name-templates.adoc[].
# icon:dot-circle[] icon:file-alt[]
message: icon:rocket[] {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}
# Path to a template file that contains the message.
# Review the available xref:configuration:name-templates.adoc[].
# Defaults to `src/jreleaser/templates/discord.tpl`.
# icon:dot-circle[]
messageTemplate: path/to/template/discord.tpl
----
TOML::
+
[source,toml]
[subs="+macros"]
----
# icon:dot-circle[]
[announce.discord]
# Enable or disable this announcer.
# Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
# Defaults to `NEVER`.
# icon:dot-circle[]
active = "ALWAYS"
# Defines the connection timeout in seconds.
# Defaults to `20`.
# icon:dot-circle[]
connectTimeout = 20
# Defines the read timeout in seconds.
# Defaults to `60`.
# icon:dot-circle[]
readTimeout = 60
# The webhook associated with a specific Discord room.
# If left unspecified, the `JRELEASER_DISCORD_WEBHOOK`
# environment variable must be defined.
# icon:exclamation-triangle[] icon:eye-slash[]
webhook = "__DO_NOT_SET_HERE__"
# The announcement message.
# Review the available xref:configuration:name-templates.adoc[].
# icon:dot-circle[] icon:file-alt[]
message = "icon:rocket[] {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}"
# Path to a template file that contains the message.
# Review the available xref:configuration:name-templates.adoc[].
# Defaults to `src/jreleaser/templates/discord.tpl`.
# icon:dot-circle[]
messageTemplate = "path/to/template/discord.tpl"
----
JSON::
+
[source,json]
[subs="+macros"]
----
{
"announce": {
// icon:dot-circle[]
"discord": {
// Enable or disable this announcer.
// Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
// Defaults to `NEVER`.
// icon:dot-circle[]
"active": "ALWAYS",
// Defines the connection timeout in seconds.
// Defaults to `20`.
// icon:dot-circle[]
"connectTimeout": 20,
// Defines the read timeout in seconds.
// Defaults to `60`.
// icon:dot-circle[]
"readTimeout": 60,
// The webhook associated with a specific Discord room.
// If left unspecified, the `JRELEASER_DISCORD_WEBHOOK`
// environment variable must be defined.
// icon:exclamation-triangle[] icon:eye-slash[]
"webhook": "__DO_NOT_SET_HERE__",
// The announcement message.
// Review the available xref:configuration:name-templates.adoc[].
// icon:dot-circle[] icon:file-alt[]
"message": "icon:rocket[] {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}",
// Path to a template file that contains the message.
// Review the available xref:configuration:name-templates.adoc[].
// Defaults to `src/jreleaser/templates/discord.tpl`.
// icon:dot-circle[]
"messageTemplate": "path/to/template/discord.tpl",
}
}
}
----
Maven::
+
[source,xml]
[subs="+macros,verbatim"]
----
<jreleaser>
<announce>
<!--
icon:dot-circle[]
-->
<discord>
<!--
Enable or disable this announcer.
Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
Defaults to `NEVER`.
icon:dot-circle[]
-->
<active>ALWAYS</active>
<!--
Defines the connection timeout in seconds.
Defaults to `20`.
icon:dot-circle[]
-->
<connectTimeout>20</connectTimeout>
<!--
Defines the read timeout in seconds.
Defaults to `60`.
icon:dot-circle[]
-->
<readTimeout>60</readTimeout>
<!--
The webhook associated with a specific Discord room.
If left unspecified, the `JRELEASER_DISCORD_WEBHOOK` environment variable must be defined.
icon:exclamation-triangle[] icon:eye-slash[]
-->
<webhook>__DO_NOT_SET_HERE__</webhook>
<!--
The announcement message.
Review the available xref:configuration>templates.adoc[].
icon:dot-circle[] icon:file-alt[]
-->
<message>icon:rocket[] {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}</message>
<!--
Path to a template file that contains the message.
Review the available xref:configuration:name-templates.adoc[].
Defaults to `src/jreleaser/templates/discord.tpl`.
icon:dot-circle[]
-->
<messageTemplate>path/to/template/discord.tpl</messageTemplate>
</discord>
</announce>
</jreleaser>
----
Gradle::
+
[source,groovy]
[subs="+macros"]
----
jreleaser {
announce {
// icon:dot-circle[]
discord {
// Enable or disable this announcer.
// Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
// Defaults to `NEVER`.
// icon:dot-circle[]
active = 'ALWAYS'
// Defines the connection timeout in seconds.
// Defaults to `20`.
// icon:dot-circle[]
connectTimeout = 20
// Defines the read timeout in seconds.
// Defaults to `60`.
// icon:dot-circle[]
readTimeout = 60
// The webhook associated with a specific Discord room.
// If left unspecified, the `JRELEASER_DISCORD_WEBHOOK`
// environment variable must be defined.
// icon:exclamation-triangle[] icon:eye-slash[]
webhook = '__DO_NOT_SET_HERE__'
// The announcement message.
// Review the available xref:configuration:name-templates.adoc[].
// icon:dot-circle[] icon:file-alt[]
message = 'icon:rocket[] {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}'
// Path to a template file that contains the message.
// Review the available xref:configuration:name-templates.adoc[].
// Defaults to `src/jreleaser/templates/discord.tpl`.
// icon:dot-circle[]
messageTemplate = 'path/to/template/discord.tpl'
}
}
}
----
====
You may define either `message` or `messageTemplate`, with the former taking precedence over the latter.

View File

@@ -224,6 +224,14 @@ The following key/values may be defined in the properties file or as environment
| JRELEASER_SNAP_GITEA_TOKEN | a Gitea personal token
|===
== Discord
[%header, cols="<1,<1", width="100%"]
|===
| Key | Description
| JRELEASER_DISCORD_WEBHOOK | the webhook URL
|===
== Gitter
[%header, cols="<1,<1", width="100%"]