diff --git a/docs/antora.yml b/docs/antora.yml index c28b143..0e8003c 100644 --- a/docs/antora.yml +++ b/docs/antora.yml @@ -13,6 +13,7 @@ nav: - modules/quick-start/nav.adoc - modules/ROOT/nav-workflow.adoc - modules/ROOT/nav-distributions.adoc +- modules/ROOT/nav-artifacts.adoc - modules/configuration/nav.adoc - modules/templates/nav.adoc - modules/continuous-integration/nav.adoc diff --git a/docs/modules/ROOT/assets/images/jreleaser-early-access.png b/docs/modules/ROOT/assets/images/jreleaser-early-access.png new file mode 100644 index 0000000..df60e50 Binary files /dev/null and b/docs/modules/ROOT/assets/images/jreleaser-early-access.png differ diff --git a/docs/modules/ROOT/nav-artifacts.adoc b/docs/modules/ROOT/nav-artifacts.adoc new file mode 100644 index 0000000..549663c --- /dev/null +++ b/docs/modules/ROOT/nav-artifacts.adoc @@ -0,0 +1 @@ +* xref:artifacts.adoc[] diff --git a/docs/modules/ROOT/pages/artifacts.adoc b/docs/modules/ROOT/pages/artifacts.adoc new file mode 100644 index 0000000..8ceb527 --- /dev/null +++ b/docs/modules/ROOT/pages/artifacts.adoc @@ -0,0 +1,246 @@ += Artifacts + +Artifacts are at the heart of a release; they define files that may be: + +* added to a Git xref:configuration:release/index.adoc[release]. +* prepared, packaged, and uploaded using a xref:configuration:packagers/index.adoc[packager]. + +== Properties + +Artifacts have the following properties: + +* `path`. Defines the location of the file. Path may be relative or absolute. We recomend defining paths +that are relative to the `basedir` as much as possible, as that simplifies the setup on +xref:continuous-integration:index.adoc[CI]. Its value may use xref:configuration:name-templates.adoc[]. +This property is *required*. + +* `transform`. Sometimes the source path does not have the exact name you'd looking for. You may apply a +name transformation using this property. Its value may use xref:configuration:name-templates.adoc[]. +This property is *optional*. + +* `platform`. Defines the OS specific platform for this file. Some xref:configuration:assemble/index.adoc[assemblers] +and xref:configuration:packagers/index.adoc[packagers] require that artifacts define a platform. + +include::configuration:partial$platform.adoc[] + +== Examples + +*Platform* + +Generating cross-platform JLink images require that each target JDK define a value for its corresponding platform. +Target JDKs are of type `artifact`. + +[tabs] +==== +YAML:: ++ +[source,yaml] +[subs="+macros"] +---- +assemble: + jlinks: + app: + active: always + jdk: + path: '{{oracleJdks}}/jdk-16_osx-x64/Contents/Home' + platform: osx + targetJdks: + - path: '{{oracleJdks}}/jdk-16_osx-x64/Contents/Home' + platform: osx + - path: '{{oracleJdks}}/jdk-16_linux-x64' + platform: linux + - path: '{{oracleJdks}}/jdk-16_windows-x64' + platform: windows + mainJar: + path: 'target/{{distributionName}}-{{projectVersion}}.jar' +---- +TOML:: ++ +[source,toml] +[subs="+macros"] +---- +[assemble.jlinks.app] + active = "ALWAYS" + mainJar = { path = "target/{{distributionName}}-{{projectVersion}}.jar" } + jdk = { path = "{{oracleJdks}}/jdk-16_osx-x64/Contents/Home", platform = "osx" } + pass:[[[assemble.jlinks.app.targetJdks]]] + path = "{{oracleJdks}}/jdk-16_osx-x64/Contents/Home" + platform = "osx" + pass:[[[assemble.jlinks.app.targetJdks]]] + path = "{{oracleJdks}}/jdk-16_linux-x64" + platform = "linux" + pass:[[[assemble.jlinks.app.targetJdks]]] + path = "{{oracleJdks}}/jdk-16_windows-x64" + platform = "windows" +---- +JSON:: ++ +[source,json] +[subs="+macros"] +---- +{ + "assemble": { + "jlinks": { + "app": { + "active": "ALWAYS", + "mainJar": { + "path": "target/{{distributionName}}-{{projectVersion}}.jar" + }, + "jdk": { + "path": "{{oracleJdks}}/jdk-16_osx-x64/Contents/Home", + "platform": "osx" + }, + "targetJdks": [ + { + "path": "{{oracleJdks}}/jdk-16_osx-x64/Contents/Home", + "platform": "osx" + }, + { + "path": "{{oracleJdks}}/jdk-16_linux-x64", + "platform": "linux" + }, + { + "path": "{{oracleJdks}}/jdk-16_windows-x64", + "platform": "windows" + } + ] + } + } + }, +} +---- +Maven:: ++ +[source,xml] +[subs="+macros,verbatim,attributes"] +---- + + + + + app + ALWAYS + + target/{{distributionName}}-{{projectVersion}}.jar + + + {{oracleJdks}}/jdk-16_osx-x64/Contents/Home + osx + + + + {{oracleJdks}}/jdk-16_osx-x64/Contents/Home + osx + + + {{oracleJdks}}/jdk-16_linux-x64 + linux + + + {{oracleJdks}}/jdk-16_windows-x64 + windows + + + + + + +---- +Gradle:: ++ +[source,groovy] +[subs="+macros"] +---- +jreleaser { + assemble { + jlinks { + app { + active = 'ALWAYS' + mainJar { + path = 'target/{{distributionName}}-{{projectVersion}}.jar' + } + jdk { + path = '{{oracleJdks}}/jdk-16_osx-x64/Contents/Home' + platform = 'osx' + } + targetJdk { + path = '{{oracleJdks}}/jdk-16_osx-x64/Contents/Home' + platform = 'osx' + } + targetJdk { + path = '{{oracleJdks}}/jdk-16_linux-x64' + platform = 'linux' + } + targetJdk { + path = '{{oracleJdks}}/jdk-16_windows-x64' + platform = 'windows' + } + } + } + } +} +---- +==== + +*Transform* + +JReleaser itself uses the `transform` property to rename its artifacts depending on the type of release. + +[source,yaml] +.jreleaser.yml +---- +distributions: + jreleaser: + artifacts: + - path: apps/{{distributionName}}/build/distributions/{{distributionName}}-{{projectVersion}}.zip + transform: '{{distributionName}}/{{distributionName}}-{{projectEffectiveVersion}}.zip' + + jreleaser-ant-tasks: + artifacts: + - path: plugins/{{distributionName}}/build/distributions/{{distributionName}}-{{projectVersion}}.zip + transform: '{{distributionName}}/{{distributionName}}-{{projectEffectiveVersion}}.zip' + + jreleaser-tool-provider: + type: SINGLE_JAR + artifacts: + - path: apps/jreleaser-tool-provider/build/libs/jreleaser-tool-provider-{{projectVersion}}.jar + transform: 'jreleaser-tool-provider/jreleaser-tool-provider-{{projectEffectiveVersion}}.jar' +---- + +Artifacts point to these files when the project version is snapshot: + +[source,sh] +---- +out +└── jreleaser + └── artifacts + ├── jreleaser + │ └── jreleaser-early-access.zip + ├── jreleaser-ant-tasks + │ └── jreleaser-ant-tasks-early-access.zip + └── jreleaser-tool-provider + └── jreleaser-tool-provider-early-access.jar +---- + +Whereas the following files will be used when the project is release: + +[source,sh] +[subs="attributes"] +---- +. +├── apps +│ ├── jreleaser +│ │ └── build +│ │ └── distributions +│ │ └── jreleaser-{jreleaser-version}.zip +│ └── jreleaser-tool-provider +│ └── build +│ └── libs +│ └── jreleaser-tool-provider-{jreleaser-version}.jar +└── plugins + └── jreleaser-ant-tasks + └── build + └── distributions + └── jreleaser-ant-tasks-{jreleaser-version}.zip +---- + diff --git a/docs/modules/ROOT/pages/distributions/jlink.adoc b/docs/modules/ROOT/pages/distributions/jlink.adoc index 21439e6..91f65c6 100644 --- a/docs/modules/ROOT/pages/distributions/jlink.adoc +++ b/docs/modules/ROOT/pages/distributions/jlink.adoc @@ -44,7 +44,7 @@ applications. Generates distribution files that follow the expected structure. A * link:https://badass-jlink-plugin.beryx.org/releases/latest/[badass-jlink-plugin] plugin: use it for *modular* applications. Generates distribution files that follow the expected structure. Also, packages the distribution as a Zip. -You may also configure a xref:configuration:assemble/jlink.adoc[] assembler. +Alternatively, you may also configure a xref:configuration:assemble/jlink.adoc[] assembler. == Packager Support diff --git a/docs/modules/ROOT/pages/distributions/native-image.adoc b/docs/modules/ROOT/pages/distributions/native-image.adoc index 008db81..5d4509a 100644 --- a/docs/modules/ROOT/pages/distributions/native-image.adoc +++ b/docs/modules/ROOT/pages/distributions/native-image.adoc @@ -12,7 +12,7 @@ Gradle plugins that can create such binaries. * link:https://www.graalvm.org/reference-manual/native-image/NativeImageMavenPlugin/[native-image-maven-plugin]. -You may also configure a xref:configuration:assemble/native-image.adoc[] assembler. +Alternatively, you may also configure a xref:configuration:assemble/native-image.adoc[] assembler. == Packager Support diff --git a/docs/modules/ROOT/pages/distributions/single-jar.adoc b/docs/modules/ROOT/pages/distributions/single-jar.adoc index 73bad1e..ea26201 100644 --- a/docs/modules/ROOT/pages/distributions/single-jar.adoc +++ b/docs/modules/ROOT/pages/distributions/single-jar.adoc @@ -3,7 +3,7 @@ Distributions of this type are comprised of a single, executable JAR, with all their dependencies available inside the JAR. These JARs are also known as `fatjar` or `uber-jar`. -Single JAR distributions *require* a suitable Java runtime to be installed on the consumer side. +Single JAR distributions *require* a suitable Java runtime to be *already installed* on the consumer side. == Creating a Distribution @@ -15,7 +15,7 @@ We recommend using the following plugins to create suitable Single JAR distribut an uber-jar. * link:https://maven.apache.org/plugins/maven-jar-plugin/[maven-jar-plugin]: if the JAR has no additional dependencies. -Make sure to make the JAR executable by setting the `Main-Class` manifest entry. +Make sure the JAR is executable by setting the `Main-Class` manifest entry. .Gradle @@ -23,7 +23,7 @@ Make sure to make the JAR executable by setting the `Main-Class` manifest entry. an uber-jar. * link:https://docs.gradle.org/current/userguide/java_plugin.html[java]: if the JAR has no additional dependencies. -Make sure to make the JAR executable by setting the `Main-Class` manifest entry. +Make sure the JAR is executable by setting the `Main-Class` manifest entry. == Packager Support diff --git a/docs/modules/ROOT/pages/index.adoc b/docs/modules/ROOT/pages/index.adoc index 49d9fe2..52734e4 100644 --- a/docs/modules/ROOT/pages/index.adoc +++ b/docs/modules/ROOT/pages/index.adoc @@ -3,7 +3,7 @@ JReleaser is a release automation tool for Java projects. Its goal is to simplify creating releases and publishing artifacts to multiple package managers while providing customizable options. -== What it Does +== What it does JReleaser takes inputs from popular builds tools (Ant, Maven, Gradle) such as JAR files, binary distributions (`.zip`, `.tar`), JLink images, or any other file that you'd like to publish as a Git release on popular Git services @@ -13,8 +13,10 @@ as Twitter, Zulip, SDKMAN!, and others. image::jreleaser-tools.png[] +== How does it work + A release process can be customized with a `jreleaser.[yml|toml|json]` file if using the xref:tools:cli.adoc[CLI] or -xref:tools:ant.adoc[ANT] options, or direct DSL configuration inside a `pom.xml` (xref:tools:maven.adoc[Maven]) or +xref:tools:ant.adoc[Ant] options, or direct DSL configuration inside a `pom.xml` (xref:tools:maven.adoc[Maven]) or `build.gradle` (xref:tools:gradle.adoc[Gradle]) file. Once setup, you can create a new release by invoking the `full-release` command. @@ -24,5 +26,6 @@ provided as templates. == Acknowledgments -JReleaser is heavily inspired by link:https://goreleaser.com[GoReleaser]. +JReleaser is heavily inspired by link:https://goreleaser.com[GoReleaser], it also builds on top of the lessons learned +from link:github.com/jbangdev/jbang[jbang]'s build setup. diff --git a/docs/modules/ROOT/pages/install.adoc b/docs/modules/ROOT/pages/install.adoc index 1ed3986..944acb7 100644 --- a/docs/modules/ROOT/pages/install.adoc +++ b/docs/modules/ROOT/pages/install.adoc @@ -18,9 +18,16 @@ sdk install jreleaser *jbang* [source] +.stable ---- // Download, cache, and run -jbang jreleaser@jreleaser +jbang jreleaser@jreleaser [] +---- +[source] +.early-access +---- +// Download, cache, and run +jbang jreleaser_snapshot@jreleaser [] ---- *manually* @@ -39,9 +46,16 @@ sdk install jreleaser *jbang* [source] +.stable ---- // Download, cache, and run -jbang jreleaser@jreleaser +jbang jreleaser@jreleaser [] +---- +[source] +.early-access +---- +// Download, cache, and run +jbang jreleaser_snapshot@jreleaser [] ---- *manually* @@ -66,9 +80,16 @@ sdk install jreleaser *jbang* [source] +.stable ---- // Download, cache, and run -jbang jreleaser@jreleaser +jbang jreleaser@jreleaser [] +---- +[source] +.early-access +---- +// Download, cache, and run +jbang jreleaser_snapshot@jreleaser [] ---- *manually* @@ -78,6 +99,20 @@ uncompress and copy to the desired location. -- ==== +== Docker +You can run JReleaser as a docker image, skipping the need to have a pre-installed Java runtime. You must mount the +working directory at the `/workspace` volume, for example assuming the current directory is the starting point: + +[source] +---- +$ docker run -it --rm -v `(pwd)`:/workspace jreleaser/jreleaser-slim: [] +---- + +NOTE: The `--basedir` argument will be automatically set to `--basedir=/workspace`. + +You may also need to map environment variables to the container, such as `JRELEASER_PROJECT_VERSION`, +`JRELEASER_GITHUB_TOKEN`, or others depending on your setup. Refer to the xref:configuration:index.adoc[] pages. + == Maven Configure the xref:tools:maven.adoc[jreleaser-maven-plugin] in your POM file diff --git a/docs/modules/configuration/nav.adoc b/docs/modules/configuration/nav.adoc index 7c0f328..374af1d 100644 --- a/docs/modules/configuration/nav.adoc +++ b/docs/modules/configuration/nav.adoc @@ -1,31 +1,31 @@ -.Configuration -* xref:environment.adoc[] -* xref:project.adoc[] -* xref:signing.adoc[] -* xref:release/index.adoc[] -** xref:release/github.adoc[] -** xref:release/gitlab.adoc[] -** xref:release/gitea.adoc[] -* xref:assemble/index.adoc[] -** xref:assemble/jlink.adoc[] -** xref:assemble/native-image.adoc[] -* xref:packagers/index.adoc[] -** xref:packagers/chocolatey.adoc[] -** xref:packagers/docker.adoc[] -** xref:packagers/homebrew.adoc[] -** xref:packagers/jbang.adoc[] -** xref:packagers/scoop.adoc[] -** xref:packagers/snap.adoc[] -* 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[] -** xref:announce/sdkman.adoc[] -** xref:announce/slack.adoc[] -** xref:announce/teams.adoc[] -** xref:announce/twitter.adoc[] -** xref:announce/zulip.adoc[] -* xref:name-templates.adoc[] +* xref:index.adoc[] +** xref:environment.adoc[] +** xref:project.adoc[] +** xref:signing.adoc[] +** xref:release/index.adoc[] +*** xref:release/github.adoc[] +*** xref:release/gitlab.adoc[] +*** xref:release/gitea.adoc[] +** xref:assemble/index.adoc[] +*** xref:assemble/jlink.adoc[] +*** xref:assemble/native-image.adoc[] +** xref:packagers/index.adoc[] +*** xref:packagers/chocolatey.adoc[] +*** xref:packagers/docker.adoc[] +*** xref:packagers/homebrew.adoc[] +*** xref:packagers/jbang.adoc[] +*** xref:packagers/scoop.adoc[] +*** xref:packagers/snap.adoc[] +** 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[] +*** xref:announce/sdkman.adoc[] +*** xref:announce/slack.adoc[] +*** xref:announce/teams.adoc[] +*** xref:announce/twitter.adoc[] +*** xref:announce/zulip.adoc[] +** xref:name-templates.adoc[] diff --git a/docs/modules/configuration/pages/announce/discord.adoc b/docs/modules/configuration/pages/announce/discord.adoc index da22b12..c045e48 100644 --- a/docs/modules/configuration/pages/announce/discord.adoc +++ b/docs/modules/configuration/pages/announce/discord.adoc @@ -254,4 +254,4 @@ jreleaser { 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. +The template file may be initialized using the `template` command. diff --git a/docs/modules/configuration/pages/announce/discussions.adoc b/docs/modules/configuration/pages/announce/discussions.adoc index 0550f9c..8c53c92 100644 --- a/docs/modules/configuration/pages/announce/discussions.adoc +++ b/docs/modules/configuration/pages/announce/discussions.adoc @@ -285,4 +285,4 @@ jreleaser { 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. +The template file may be initialized using the `template` command. diff --git a/docs/modules/configuration/pages/announce/gitter.adoc b/docs/modules/configuration/pages/announce/gitter.adoc index 83d6b30..4facd1a 100644 --- a/docs/modules/configuration/pages/announce/gitter.adoc +++ b/docs/modules/configuration/pages/announce/gitter.adoc @@ -253,4 +253,4 @@ jreleaser { 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. +The template file may be initialized using the `template` command. diff --git a/docs/modules/configuration/pages/announce/mail.adoc b/docs/modules/configuration/pages/announce/mail.adoc index fad2d68..bc5ab05 100644 --- a/docs/modules/configuration/pages/announce/mail.adoc +++ b/docs/modules/configuration/pages/announce/mail.adoc @@ -525,7 +525,7 @@ NOTE: At least one of `to`, `cc`, or `bcc` must be specified. 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. +The template file may be initialized using the `template` command. The following mail properties will be set by default given these conditions: diff --git a/docs/modules/configuration/pages/announce/slack.adoc b/docs/modules/configuration/pages/announce/slack.adoc index 8b22646..d835abd 100644 --- a/docs/modules/configuration/pages/announce/slack.adoc +++ b/docs/modules/configuration/pages/announce/slack.adoc @@ -9,9 +9,9 @@ scopes set: 1. Log into the target Slack workspace. 2. Create a link:https://api.slack.com/apps/new[Slack app]. -4. Click on Incoming Webhooks. -5. Create a new webhook. -6. Copy the generated webhook URL. +3. Click on Incoming Webhooks. +4. Create a new webhook. +5. 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_SLACK_WEBHOOK` environment variable over explicitly setting a value in the configuration DSL. @@ -316,4 +316,4 @@ jreleaser { 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. +The template file may be initialized using the `template` command. diff --git a/docs/modules/configuration/pages/announce/teams.adoc b/docs/modules/configuration/pages/announce/teams.adoc index f99c9e0..ddca7f1 100644 --- a/docs/modules/configuration/pages/announce/teams.adoc +++ b/docs/modules/configuration/pages/announce/teams.adoc @@ -228,4 +228,4 @@ jreleaser { The message must follow the link:https://docs.microsoft.com/en-us/outlook/actionable-messages/adaptive-card[Adaptive Card] format. -The template file may be initialized using the template command. +The template file may be initialized using the `template` command. diff --git a/docs/modules/configuration/pages/announce/twitter.adoc b/docs/modules/configuration/pages/announce/twitter.adoc index 6492730..ed9f35b 100644 --- a/docs/modules/configuration/pages/announce/twitter.adoc +++ b/docs/modules/configuration/pages/announce/twitter.adoc @@ -308,5 +308,5 @@ jreleaser { ---- ==== -The template file may be initialized using the template command. +The template file may be initialized using the `template` command. diff --git a/docs/modules/configuration/pages/announce/zulip.adoc b/docs/modules/configuration/pages/announce/zulip.adoc index b8bae29..1235c31 100644 --- a/docs/modules/configuration/pages/announce/zulip.adoc +++ b/docs/modules/configuration/pages/announce/zulip.adoc @@ -343,4 +343,4 @@ jreleaser { 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. +The template file may be initialized using the `template` command. diff --git a/docs/modules/configuration/pages/assemble/jlink.adoc b/docs/modules/configuration/pages/assemble/jlink.adoc index d99bbd4..ba9bd28 100644 --- a/docs/modules/configuration/pages/assemble/jlink.adoc +++ b/docs/modules/configuration/pages/assemble/jlink.adoc @@ -20,7 +20,7 @@ YAML:: # icon:dot-circle[] assemble: # icon:dot-circle[] - jlink: + jlinks: # Assemblers require a name. # icon:exclamation-triangle[] app: @@ -157,7 +157,7 @@ TOML:: ---- # Assemblers require a name. # icon:exclamation-triangle[] -[assemble.jlink.app] +[assemble.jlinks.app] # Enables or disables the assembler. # Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`]. @@ -283,7 +283,7 @@ JSON:: // icon:dot-circle[] "assemble": { // icon:dot-circle[] - "jlink": { + "jlinks": { // Assemblers require a name. // icon:exclamation-triangle[] "app": { @@ -442,7 +442,7 @@ Maven:: - + - +