diff --git a/docs/modules/reference/nav.adoc b/docs/modules/reference/nav.adoc index 6a53592cc..ba8a9338c 100644 --- a/docs/modules/reference/nav.adoc +++ b/docs/modules/reference/nav.adoc @@ -57,6 +57,7 @@ ** xref:hooks/index.adoc[] *** xref:hooks/command.adoc[] *** xref:hooks/script.adoc[] +** xref:matrix.adoc[] ** xref:name-templates.adoc[] ** xref:packagers/index.adoc[] *** xref:packagers/appimage.adoc[] diff --git a/docs/modules/reference/pages/assemble/archive.adoc b/docs/modules/reference/pages/assemble/archive.adoc index c9c9732f4..5b68d5b80 100644 --- a/docs/modules/reference/pages/assemble/archive.adoc +++ b/docs/modules/reference/pages/assemble/archive.adoc @@ -49,6 +49,24 @@ include::partial$assemble/yaml/common-head.adoc[] - ZIP - TGZ + # Includes the default matrix. + # icon:dot-circle[] + applyDefaultMatrix: false + + # Configures matrix variables. + # icon:dot-circle[] + matrix: + vars: + os: [ linux, osx, windows ] + arch: [ arm64, amd64 ] + rows: + - { os: linux, arch: arm64 } + - { os: linux, arch: amd64 } + - { os: osx, arch: arm64 } + - { os: osx, arch: amd64 } + - { os: windows, arch: arm64 } + - { os: windows, arch: amd64 } + include::partial$assemble/yaml/common-archive-options.adoc[] include::partial$assemble/yaml/common-assembler.adoc[] @@ -86,6 +104,21 @@ include::partial$assemble/toml/common-head.adoc[] # icon:dot-circle[] formats = [ "ZIP", "TGZ"] + # Includes the default matrix. + # icon:dot-circle[] + applyDefaultMatrix = false + + # Configures matrix variables. + # icon:dot-circle[] + matrix.vars.os = [ "linux", "osx", "windows" ] + matrix.vars.arch= [ "arm64", "amd64" ] + rows = [{ os = "linux", arch = "arm64" }, + { os = "linux", arch = "amd64" }, + { os = "osx", arch = "arm64" }, + { os = "osx", arch = "amd64" }, + { os = "windows", arch = "arm64" }, + { os = "windows", arch = "amd64" }] + include::partial$assemble/toml/common-archive-options.adoc[] include::partial$assemble/toml/common-assembler.adoc[] @@ -126,6 +159,27 @@ include::partial$assemble/json/common-head.adoc[] "TGZ" ], + // Includes the default matrix. + // icon:dot-circle[] + "applyDefaultMatrix": false, + + // Configures matrix variables. + // icon:dot-circle[] + "matrix": { + "vars": { + "os": [ "linux", "osx", "windows" ], + "arch": [ "arm64", "amd64" ] + }, + "rows": [ + { "os": "linux", "arch": "arm64" }, + { "os": "linux", "arch": "amd64" }, + { "os": "osx", "arch": "arm64" }, + { "os": "osx", "arch": "amd64" }, + { "os": "windows", "arch": "arm64" }, + { "os": "windows", "arch": "amd64" } + ] + } + include::partial$assemble/json/common-archive-options.adoc[] include::partial$assemble/json/common-assembler.adoc[] @@ -175,6 +229,56 @@ include::partial$assemble/maven/common-head.adoc[] TGZ + + false + + + + + + linux + osx + windows + + + arm64 + amd64 + + + + + linux + arm64 + + + linux + amd64 + + + osx + arm64 + + + osx + amd64 + + + windows + arm64 + + + windows + amd64 + + + + include::partial$assemble/maven/common-archive-options.adoc[] include::partial$assemble/maven/common-assembler.adoc[] @@ -216,6 +320,24 @@ include::partial$assemble/gradle/common-head.adoc[] 'TGZ' ] + // Includes the default matrix. + // icon:dot-circle[] + applyDefaultMatrix = false + + // Configures matrix variables. + // icon:dot-circle[] + matrix { + variable('os', ['linux', 'osx', 'windows']) + variable('arch', ['arm64', 'amd64']) + + row(os: 'linux', arch: 'arm64') + row(os: 'linux', arch: 'amd64') + row(os: 'osx', arch: 'arm64') + row(os: 'osx', arch: 'amd64') + row(os: 'windows', arch: 'arm64') + row(os: 'windows', arch: 'amd64') + } + include::partial$assemble/gradle/common-archive-options.adoc[] include::partial$assemble/gradle/common-assembler.adoc[] diff --git a/docs/modules/reference/pages/hooks/command.adoc b/docs/modules/reference/pages/hooks/command.adoc index da9dd0722..a29642ffd 100644 --- a/docs/modules/reference/pages/hooks/command.adoc +++ b/docs/modules/reference/pages/hooks/command.adoc @@ -27,10 +27,29 @@ hooks: condition: '"{{ Env.CI }}" == true' # A map of global environment variables. + # Accepts values from `matrix`. # icon:dot-circle[] icon:file-alt[] environment: FOO: bar + # Includes the default matrix. + # icon:dot-circle[] + applyDefaultMatrix: false + + # Configures matrix variables. + # icon:dot-circle[] + matrix: + vars: + os: [ linux, osx, windows ] + arch: [ arm64, amd64 ] + rows: + - { os: linux, arch: arm64 } + - { os: linux, arch: amd64 } + - { os: osx, arch: arm64 } + - { os: osx, arch: amd64 } + - { os: windows, arch: arm64 } + - { os: windows, arch: amd64 } + # icon:dot-circle[] command: # Enable or disable all before, success, and failure hooks. @@ -44,10 +63,30 @@ hooks: condition: '"{{ Env.CI }}" == true' # A map of command environment variables. + # Accepts values from `matrix`. # icon:dot-circle[] icon:file-alt[] environment: FOO: bar + # Includes the default matrix. + # icon:dot-circle[] + applyDefaultMatrix: false + + # Configures matrix variables. + # Values will be inherited from `hooks`. + # icon:dot-circle[] + matrix: + vars: + os: [ linux, osx, windows ] + arch: [ arm64, amd64 ] + rows: + - { os: linux, arch: arm64 } + - { os: linux, arch: amd64 } + - { os: osx, arch: arm64 } + - { os: osx, arch: amd64 } + - { os: windows, arch: arm64 } + - { os: windows, arch: amd64 } + # The type of hook # Valid entries are `before`, `success`, `failure`. # icon:dot-circle[] @@ -69,15 +108,36 @@ hooks: active: ALWAYS # A map of local environment variables. + # Accepts values from `matrix`. # icon:dot-circle[] icon:file-alt[] environment: FOO: bar + # Includes the default matrix. + # icon:dot-circle[] + applyDefaultMatrix: false + + # Configures matrix variables. + # Values will be inherited from `command`. + # icon:dot-circle[] + matrix: + vars: + os: [ linux, osx, windows ] + arch: [ arm64, amd64 ] + rows: + - { os: linux, arch: arm64 } + - { os: linux, arch: amd64 } + - { os: osx, arch: arm64 } + - { os: osx, arch: amd64 } + - { os: windows, arch: arm64 } + - { os: windows, arch: amd64 } + # Execute the command if the condition evaluates to `true`. # icon:dot-circle[] icon:file-alt[] condition: '"{{ Env.CI }}" == true' # The command to be invoked. + # Accepts values from `matrix`. # icon:exclamation-triangle[] icon:file-alt[] cmd: '{{basedir}}/notifier.sh {{event.name}} {{event.type}} {{projectVersion}}' @@ -114,9 +174,25 @@ TOML:: condition = "'{{ Env.CI }}' == true" # A map of global environment variables. + # Accepts values from `matrix`. # icon:dot-circle[] icon:file-alt[] environment.FOO = "bar" + # Includes the default matrix. + # icon:dot-circle[] + applyDefaultMatrix = false + + # Configures matrix variables. + # icon:dot-circle[] + matrix.vars.os = [ "linux", "osx", "windows" ] + matrix.vars.arch= [ "arm64", "amd64" ] + rows = [{ os = "linux", arch = "arm64" }, + { os = "linux", arch = "amd64" }, + { os = "osx", arch = "arm64" }, + { os = "osx", arch = "amd64" }, + { os = "windows", arch = "arm64" }, + { os = "windows", arch = "amd64" }] + # icon:dot-circle[] [hooks.command] # Enable or disable all before, success, and failure hooks. @@ -130,9 +206,26 @@ TOML:: condition = "'{{ Env.CI }}' == true" # A map of command environment variables. + # Accepts values from `matrix`. # icon:dot-circle[] icon:file-alt[] environment.FOO = "bar" + # Includes the default matrix. + # icon:dot-circle[] + applyDefaultMatrix = false + + # Configures matrix variables. + # Values will be inherited from `hooks`. + # icon:dot-circle[] + matrix.vars.os = [ "linux", "osx", "windows" ] + matrix.vars.arch= [ "arm64", "amd64" ] + rows = [{ os = "linux", arch = "arm64" }, + { os = "linux", arch = "amd64" }, + { os = "osx", arch = "arm64" }, + { os = "osx", arch = "amd64" }, + { os = "windows", arch = "arm64" }, + { os = "windows", arch = "amd64" }] + # The type of hook # Valid entries are `before`, `success`, `failure`. # icon:dot-circle[] @@ -154,14 +247,32 @@ TOML:: active = "ALWAYS" # A map of local environment variables. + # Accepts values from `matrix`. # icon:dot-circle[] icon:file-alt[] environment.FOO = "bar" + # Includes the default matrix. + # icon:dot-circle[] + applyDefaultMatrix = false + + # Configures matrix variables. + # Values will be inherited from `command`. + # icon:dot-circle[] + matrix.vars.os = [ "linux", "osx", "windows" ] + matrix.vars.arch= [ "arm64", "amd64" ] + rows = [{ os = "linux", arch = "arm64" }, + { os = "linux", arch = "amd64" }, + { os = "osx", arch = "arm64" }, + { os = "osx", arch = "amd64" }, + { os = "windows", arch = "arm64" }, + { os = "windows", arch = "amd64" }] + # Execute the command if the condition evaluates to `true`. # icon:dot-circle[] icon:file-alt[] condition = "'{{ Env.CI }}' == true" # The command to be invoked. + # Accepts values from `matrix`. # icon:exclamation-triangle[] icon:file-alt[] cmd = "{{basedir}}/notifier.sh {{event.name}} {{event.type}} {{projectVersion}}" @@ -196,11 +307,33 @@ JSON:: "condition": "'{{ Env.CI }}' == true", // A map of global environment variables. + // Accepts values from `matrix`. // icon:dot-circle[] icon:eye-slash[] "environment": { "FOO": "bar" }, + // Includes the default matrix. + // icon:dot-circle[] + "applyDefaultMatrix": false, + + // Configures matrix variables. + // icon:dot-circle[] + "matrix": { + "vars": { + "os": [ "linux", "osx", "windows" ], + "arch": [ "arm64", "amd64" ] + }, + "rows": [ + { "os": "linux", "arch": "arm64" }, + { "os": "linux", "arch": "amd64" }, + { "os": "osx", "arch": "arm64" }, + { "os": "osx", "arch": "amd64" }, + { "os": "windows", "arch": "arm64" }, + { "os": "windows", "arch": "amd64" } + ] + }, + // icon:dot-circle[] "command": { // Enable or disable all before, success, and failure hooks. @@ -214,11 +347,34 @@ JSON:: "condition": "'{{ Env.CI }}' == true", // A map of command environment variables. + // Accepts values from `matrix`. // icon:dot-circle[] icon:eye-slash[] "environment": { "FOO": "bar" }, + // Includes the default matrix. + // icon:dot-circle[] + "applyDefaultMatrix": false, + + // Configures matrix variables. + // Values will be inherited from `hooks`. + // icon:dot-circle[] + "matrix": { + "vars": { + "os": [ "linux", "osx", "windows" ], + "arch": [ "arm64", "amd64" ] + }, + "rows": [ + { "os": "linux", "arch": "arm64" }, + { "os": "linux", "arch": "amd64" }, + { "os": "osx", "arch": "arm64" }, + { "os": "osx", "arch": "amd64" }, + { "os": "windows", "arch": "arm64" }, + { "os": "windows", "arch": "amd64" } + ] + }, + // The type of hook // Valid entries are `before`, `success`, `failure`. // icon:dot-circle[] @@ -241,16 +397,40 @@ JSON:: "active": "ALWAYS", // A map of local environment variables. + // Accepts values from `matrix`. // icon:dot-circle[] icon:eye-slash[] "environment": { "FOO": "bar" }, + // Includes the default matrix. + // icon:dot-circle[] + "applyDefaultMatrix": false, + + // Configures matrix variables. + // Values will be inherited from `script`. + // icon:dot-circle[] + "matrix": { + "vars": { + "os": [ "linux", "osx", "windows" ], + "arch": [ "arm64", "amd64" ] + }, + "rows": [ + { "os": "linux", "arch": "arm64" }, + { "os": "linux", "arch": "amd64" }, + { "os": "osx", "arch": "arm64" }, + { "os": "osx", "arch": "amd64" }, + { "os": "windows", "arch": "arm64" }, + { "os": "windows", "arch": "amd64" } + ] + }, + // Execute the command if the condition evaluates to `true`. // icon:dot-circle[] icon:file-alt[] "condition": "'{{ Env.CI }}' == true", // The command to be invoked. + // Accepts values from `matrix`. // icon:exclamation-triangle[] icon:file-alt[] "cmd": "{{basedir}}/notifier.sh {{event.name}} {{event.type}} {{projectVersion}}", @@ -302,12 +482,63 @@ Maven:: bar + + false + + + + + + linux + osx + windows + + + arm64 + amd64 + + + + + linux + arm64 + + + linux + amd64 + + + osx + arm64 + + + osx + amd64 + + + windows + arm64 + + + windows + amd64 + + + + @@ -328,12 +559,64 @@ Maven:: bar + + false + + + + + + linux + osx + windows + + + arm64 + amd64 + + + + + linux + arm64 + + + linux + amd64 + + + osx + arm64 + + + osx + amd64 + + + windows + arm64 + + + windows + amd64 + + + + bar + + false + + + + + + linux + osx + windows + + + arm64 + amd64 + + + + + linux + arm64 + + + linux + amd64 + + + osx + arm64 + + + osx + amd64 + + + windows + arm64 + + + windows + amd64 + + + + {{basedir}}/notifier.sh {{event.name}} {{event.type}} {{projectVersion}} @@ -428,9 +764,28 @@ jreleaser { condition = '"{{ Env.CI }}" == true' // A map of global environment variables. + // Accepts values from `matrix`. // icon:dot-circle[] icon:file-alt[] environment('FOO', 'bar') + // Includes the default matrix. + // icon:dot-circle[] + applyDefaultMatrix = false + + // Configures matrix variables. + // icon:dot-circle[] + matrix { + variable('os', ['linux', 'osx', 'windows']) + variable('arch', ['arm64', 'amd64']) + + row(os: 'linux', arch: 'arm64') + row(os: 'linux', arch: 'amd64') + row(os: 'osx', arch: 'arm64') + row(os: 'osx', arch: 'amd64') + row(os: 'windows', arch: 'arm64') + row(os: 'windows', arch: 'amd64') + } + // icon:dot-circle[] command { // Enable or disable all before, success, and failure hooks. @@ -444,9 +799,29 @@ jreleaser { condition = '"{{ Env.CI }}" == true' // A map of command environment variables. + // Accepts values from `matrix`. // icon:dot-circle[] icon:file-alt[] environment('FOO', 'bar') - + + // Includes the default matrix. + // icon:dot-circle[] + applyDefaultMatrix = false + + // Configures matrix variables. + // Values will be inherited from `hooks`. + // icon:dot-circle[] + matrix { + variable('os', ['linux', 'osx', 'windows']) + variable('arch', ['arm64', 'amd64']) + + row(os: 'linux', arch: 'arm64') + row(os: 'linux', arch: 'amd64') + row(os: 'osx', arch: 'arm64') + row(os: 'osx', arch: 'amd64') + row(os: 'windows', arch: 'arm64') + row(os: 'windows', arch: 'amd64') + } + // The type of hook // Valid entries are `before`, `success`, `failure`. // icon:dot-circle[] @@ -468,14 +843,35 @@ jreleaser { active = 'ALWAYS' // A map of local environment variables. + // Accepts values from `matrix`. // icon:dot-circle[] icon:file-alt[] environment('FOO', 'bar') + // Includes the default matrix. + // icon:dot-circle[] + applyDefaultMatrix = false + + // Configures matrix variables. + // Values will be inherited from `command`. + // icon:dot-circle[] + matrix { + variable('os', ['linux', 'osx', 'windows']) + variable('arch', ['arm64', 'amd64']) + + row(os: 'linux', arch: 'arm64') + row(os: 'linux', arch: 'amd64') + row(os: 'osx', arch: 'arm64') + row(os: 'osx', arch: 'amd64') + row(os: 'windows', arch: 'arm64') + row(os: 'windows', arch: 'amd64') + } + // Execute the command if the condition evaluates to `true`. // icon:dot-circle[] icon:file-alt[] condition = '"{{ Env.CI }}" == true' // The command to be invoked. + // Accepts values from `matrix`. // icon:exclamation-triangle[] icon:file-alt[] cmd = "{{basedir}}/notifier.sh {{event.name}} {{event.type}} {{projectVersion}}" diff --git a/docs/modules/reference/pages/hooks/script.adoc b/docs/modules/reference/pages/hooks/script.adoc index 8165c7829..640c54452 100644 --- a/docs/modules/reference/pages/hooks/script.adoc +++ b/docs/modules/reference/pages/hooks/script.adoc @@ -29,10 +29,29 @@ hooks: condition: '"{{ Env.CI }}" == true' # A map of global environment variables. + # Accepts values from `matrix`. # icon:dot-circle[] icon:file-alt[] environment: FOO: bar + # Includes the default matrix. + # icon:dot-circle[] + applyDefaultMatrix: false + + # Configures matrix variables. + # icon:dot-circle[] + matrix: + vars: + os: [ linux, osx, windows ] + arch: [ arm64, amd64 ] + rows: + - { os: linux, arch: arm64 } + - { os: linux, arch: amd64 } + - { os: osx, arch: arm64 } + - { os: osx, arch: amd64 } + - { os: windows, arch: arm64 } + - { os: windows, arch: amd64 } + # icon:dot-circle[] script: # Enable or disable all before, success, and failure hooks. @@ -45,11 +64,31 @@ hooks: # icon:dot-circle[] icon:file-alt[] condition: '"{{ Env.CI }}" == true' - # A map of script environment variables.. + # A map of script environment variables. + # Accepts values from `matrix`. # icon:dot-circle[] icon:file-alt[] environment: FOO: bar + # Includes the default matrix. + # icon:dot-circle[] + applyDefaultMatrix: false + + # Configures matrix variables. + # Values will be inherited from `hooks`. + # icon:dot-circle[] + matrix: + vars: + os: [ linux, osx, windows ] + arch: [ arm64, amd64 ] + rows: + - { os: linux, arch: arm64 } + - { os: linux, arch: amd64 } + - { os: osx, arch: arm64 } + - { os: osx, arch: amd64 } + - { os: windows, arch: arm64 } + - { os: windows, arch: amd64 } + # The type of hook # Valid entries are `before`, `success`, `failure`. # icon:dot-circle[] @@ -70,11 +109,30 @@ hooks: # icon:dot-circle[] icon:eye-slash[] active: ALWAYS - # A map of local environment variables.. + # A map of local environment vatiables. # icon:dot-circle[] icon:file-alt[] environment: FOO: bar + # Includes the default matrix. + # icon:dot-circle[] + applyDefaultMatrix: false + + # Configures matrix variables. + # Values will be inherited from `script`. + # icon:dot-circle[] + matrix: + vars: + os: [ linux, osx, windows ] + arch: [ arm64, amd64 ] + rows: + - { os: linux, arch: arm64 } + - { os: linux, arch: amd64 } + - { os: osx, arch: arm64 } + - { os: osx, arch: amd64 } + - { os: windows, arch: arm64 } + - { os: windows, arch: amd64 } + # Execute the script if the condition evaluates to `true`. # icon:dot-circle[] icon:file-alt[] condition: '"{{ Env.CI }}" == true' @@ -86,6 +144,7 @@ hooks: shell: BASH # The script to be invoked. + # Accepts values from `matrix`. # icon:exclamation-triangle[] icon:file-alt[] run: '{{basedir}}/notifier.sh {{event.name}} {{event.type}} {{projectVersion}}' @@ -121,10 +180,26 @@ TOML:: # icon:dot-circle[] icon:file-alt[] condition = "'{{ Env.CI }}' == true" - # A map of global environment variables.. + # A map of global environment vatiables. + # Accepts values from `matrix`. # icon:dot-circle[] icon:file-alt[] environment.FOO = "bar" + # Includes the default matrix. + # icon:dot-circle[] + applyDefaultMatrix = false + + # Configures matrix variables. + # icon:dot-circle[] + matrix.vars.os = [ "linux", "osx", "windows" ] + matrix.vars.arch= [ "arm64", "amd64" ] + rows = [{ os = "linux", arch = "arm64" }, + { os = "linux", arch = "amd64" }, + { os = "osx", arch = "arm64" }, + { os = "osx", arch = "amd64" }, + { os = "windows", arch = "arm64" }, + { os = "windows", arch = "amd64" }] + # icon:dot-circle[] [hooks.script] # Enable or disable all before, success, and failure hooks. @@ -137,10 +212,26 @@ TOML:: # icon:dot-circle[] icon:file-alt[] condition = "'{{ Env.CI }}' == true" - # A map of script environment variables.. + # A map of script environment vatiables. # icon:dot-circle[] icon:file-alt[] environment.FOO = "bar" + # Includes the default matrix. + # icon:dot-circle[] + applyDefaultMatrix = false + + # Configures matrix variables. + # Values will be inherited from `hooks`. + # icon:dot-circle[] + matrix.vars.os = [ "linux", "osx", "windows" ] + matrix.vars.arch= [ "arm64", "amd64" ] + rows = [{ os = "linux", arch = "arm64" }, + { os = "linux", arch = "amd64" }, + { os = "osx", arch = "arm64" }, + { os = "osx", arch = "amd64" }, + { os = "windows", arch = "arm64" }, + { os = "windows", arch = "amd64" }] + # The type of hook # Valid entries are `before`, `success`, `failure`. # icon:dot-circle[] @@ -161,10 +252,27 @@ TOML:: # icon:dot-circle[] icon:eye-slash[] active = "ALWAYS" - # A map of local environment variables.. + # A map of local environment vatiables. + # Accepts values from `matrix`. # icon:dot-circle[] icon:file-alt[] environment.FOO = "bar" + # Includes the default matrix. + # icon:dot-circle[] + applyDefaultMatrix = false + + # Configures matrix variables. + # Values will be inherited from `script`. + # icon:dot-circle[] + matrix.vars.os = [ "linux", "osx", "windows" ] + matrix.vars.arch= [ "arm64", "amd64" ] + rows = [{ os = "linux", arch = "arm64" }, + { os = "linux", arch = "amd64" }, + { os = "osx", arch = "arm64" }, + { os = "osx", arch = "amd64" }, + { os = "windows", arch = "arm64" }, + { os = "windows", arch = "amd64" }] + # Execute the script if the condition evaluates to `true`. # icon:dot-circle[] icon:file-alt[] condition = "'{{ Env.CI }}' == true" @@ -176,6 +284,7 @@ TOML:: shell = "BASH" # The script to be invoked. + # Accepts values from `matrix`. # icon:exclamation-triangle[] icon:file-alt[] run = "{{basedir}}/notifier.sh {{event.name}} {{event.type}} {{projectVersion}}" @@ -209,12 +318,34 @@ JSON:: // icon:dot-circle[] icon:file-alt[] "condition": "'{{ Env.CI }}' == true", - // A map of global environment variables.. + // A map of global environment vatiables. + // Accepts values from `matrix`. // icon:dot-circle[] icon:eye-slash[] "environment": { "FOO": "bar" }, + // Includes the default matrix. + // icon:dot-circle[] + "applyDefaultMatrix": false, + + // Configures matrix variables. + // icon:dot-circle[] + "matrix": { + "vars": { + "os": [ "linux", "osx", "windows" ], + "arch": [ "arm64", "amd64" ] + }, + "rows": [ + { "os": "linux", "arch": "arm64" }, + { "os": "linux", "arch": "amd64" }, + { "os": "osx", "arch": "arm64" }, + { "os": "osx", "arch": "amd64" }, + { "os": "windows", "arch": "arm64" }, + { "os": "windows", "arch": "amd64" } + ] + }, + // icon:dot-circle[] "script": { // Enable or disable all before, success, and failure hooks. @@ -227,12 +358,35 @@ JSON:: // icon:dot-circle[] icon:file-alt[] "condition": "'{{ Env.CI }}' == true", - // A map of script environment variables.. + // A map of script environment vatiables. + // Accepts values from `matrix`. // icon:dot-circle[] icon:eye-slash[] "environment": { "FOO": "bar" }, + // Includes the default matrix. + // icon:dot-circle[] + "applyDefaultMatrix": false, + + // Configures matrix variables. + // Values will be inherited from `hooks`. + // icon:dot-circle[] + "matrix": { + "vars": { + "os": [ "linux", "osx", "windows" ], + "arch": [ "arm64", "amd64" ] + }, + "rows": [ + { "os": "linux", "arch": "arm64" }, + { "os": "linux", "arch": "amd64" }, + { "os": "osx", "arch": "arm64" }, + { "os": "osx", "arch": "amd64" }, + { "os": "windows", "arch": "arm64" }, + { "os": "windows", "arch": "amd64" } + ] + }, + // The type of hook // Valid entries are `before`, `success`, `failure`. // icon:dot-circle[] @@ -254,12 +408,35 @@ JSON:: // icon:dot-circle[] icon:eye-slash[] "active": "ALWAYS", - // A map of local environment variables.. + // A map of local environment vatiables. + // Accepts values from `matrix`. // icon:dot-circle[] icon:eye-slash[] "environment": { "FOO": "bar" }, + // Includes the default matrix. + // icon:dot-circle[] + "applyDefaultMatrix": false, + + // Configures matrix variables. + // Values will be inherited from `script`. + // icon:dot-circle[] + "matrix": { + "vars": { + "os": [ "linux", "osx", "windows" ], + "arch": [ "arm64", "amd64" ] + }, + "rows": [ + { "os": "linux", "arch": "arm64" }, + { "os": "linux", "arch": "amd64" }, + { "os": "osx", "arch": "arm64" }, + { "os": "osx", "arch": "amd64" }, + { "os": "windows", "arch": "arm64" }, + { "os": "windows", "arch": "amd64" } + ] + }, + // Execute the script if the condition evaluates to `true`. // icon:dot-circle[] icon:file-alt[] "condition": "'{{ Env.CI }}' == true", @@ -271,6 +448,7 @@ JSON:: "shell": "BASH", // The script to be invoked. + // Accepts values from `matrix`. // icon:exclamation-triangle[] icon:file-alt[] "run": "{{basedir}}/notifier.sh {{event.name}} {{event.type}} {{projectVersion}}", @@ -322,12 +500,63 @@ Maven:: bar + + false + + + + + + linux + osx + windows + + + arm64 + amd64 + + + + + linux + arm64 + + + linux + amd64 + + + osx + arm64 + + + osx + amd64 + + + windows + arm64 + + + windows + amd64 + + + + @@ -348,12 +577,64 @@ Maven:: bar + + false + + + + + + linux + osx + windows + + + arm64 + amd64 + + + + + linux + arm64 + + + linux + amd64 + + + osx + arm64 + + + osx + amd64 + + + windows + arm64 + + + windows + amd64 + + + + bar + + false + + + + + + linux + osx + windows + + + arm64 + amd64 + + + + + linux + arm64 + + + linux + amd64 + + + osx + arm64 + + + osx + amd64 + + + windows + arm64 + + + windows + amd64 + + + + {{basedir}}/notifier.sh {{event.name}} {{event.type}} {{projectVersion}} @@ -456,9 +790,28 @@ jreleaser { condition = '"{{ Env.CI }}" == true' // A map of global environment variables. + // Accepts values from `matrix`. // icon:dot-circle[] icon:file-alt[] environment('FOO', 'bar') + // Includes the default matrix. + // icon:dot-circle[] + applyDefaultMatrix = false + + // Configures matrix variables. + // icon:dot-circle[] + matrix { + variable('os', ['linux', 'osx', 'windows']) + variable('arch', ['arm64', 'amd64']) + + row(os: 'linux', arch: 'arm64') + row(os: 'linux', arch: 'amd64') + row(os: 'osx', arch: 'arm64') + row(os: 'osx', arch: 'amd64') + row(os: 'windows', arch: 'arm64') + row(os: 'windows', arch: 'amd64') + } + // icon:dot-circle[] script { // Enable or disable all before, success, and failure hooks. @@ -472,9 +825,29 @@ jreleaser { condition = '"{{ Env.CI }}" == true' // A map of script environment variables. + // Accepts values from `matrix`. // icon:dot-circle[] icon:file-alt[] environment('FOO', 'bar') + // Includes the default matrix. + // icon:dot-circle[] + applyDefaultMatrix = false + + // Configures matrix variables. + // Values will be inherited from `hooks`. + // icon:dot-circle[] + matrix { + variable('os', ['linux', 'osx', 'windows']) + variable('arch', ['arm64', 'amd64']) + + row(os: 'linux', arch: 'arm64') + row(os: 'linux', arch: 'amd64') + row(os: 'osx', arch: 'arm64') + row(os: 'osx', arch: 'amd64') + row(os: 'windows', arch: 'arm64') + row(os: 'windows', arch: 'amd64') + } + // The type of hook // Valid entries are `before`, `success`, `failure`. // icon:dot-circle[] @@ -496,9 +869,29 @@ jreleaser { active = 'ALWAYS' // A map of local environment variables. + // Accepts values from `matrix`. // icon:dot-circle[] icon:file-alt[] environment('FOO', 'bar') + // Includes the default matrix. + // icon:dot-circle[] + applyDefaultMatrix = false + + // Configures matrix variables. + // Values will be inherited from `script`. + // icon:dot-circle[] + matrix { + variable('os', ['linux', 'osx', 'windows']) + variable('arch', ['arm64', 'amd64']) + + row(os: 'linux', arch: 'arm64') + row(os: 'linux', arch: 'amd64') + row(os: 'osx', arch: 'arm64') + row(os: 'osx', arch: 'amd64') + row(os: 'windows', arch: 'arm64') + row(os: 'windows', arch: 'amd64') + } + // Execute the script if the condition evaluates to `true`. // icon:dot-circle[] icon:file-alt[] condition = '"{{ Env.CI }}" == true' @@ -510,6 +903,7 @@ jreleaser { shell = 'BASH' // The script to be invoked. + // Accepts values from `matrix`. // icon:exclamation-triangle[] icon:file-alt[] run = "{{basedir}}/notifier.sh {{event.name}} {{event.type}} {{projectVersion}}" diff --git a/docs/modules/reference/pages/matrix.adoc b/docs/modules/reference/pages/matrix.adoc new file mode 100644 index 000000000..dd016ef29 --- /dev/null +++ b/docs/modules/reference/pages/matrix.adoc @@ -0,0 +1,325 @@ += Matrix + +A matrix lets you define variables that can be used to parameterize xref:reference:hooks/index.adoc[], +and xref:reference:assemble/archive.adoc[]. Other elements may be added in the future. These variables +create multiple copies of the intended target. + +A matrix defined in this section is not automaticallt applied. You must configure the `applyDefaultMatrix` +property in the given element. This allows you defining multiple matrices depending on the use case. + +== Configuration + +WARNING: You can only define `variables` or `rows` but not both. + +The following configuration shows the definition of a 3x3 matrix with both `variables` and `rows +for reference. + +include::partial$legend.adoc[] + +[tabs] +==== +YAML:: ++ +-- +[source,yaml] +[subs="+macros"] +---- +# Configures matrix variables. +# icon:dot-circle[] +matrix: + vars: + os: [ linux, osx, windows ] + arch: [ arm64, amd64 ] + rows: + - { os: linux, arch: arm64 } + - { os: linux, arch: amd64 } + - { os: osx, arch: arm64 } + - { os: osx, arch: amd64 } + - { os: windows, arch: arm64 } + - { os: windows, arch: amd64 } +---- +-- +TOML:: ++ +-- +[source,toml] +[subs="+macros"] +---- +# Configures matrix variables. +# icon:dot-circle[] +[matrix] + vars.os = [ "linux", "osx", "windows" ] + vars.arch = [ "arm64", "amd64" ] + rows = [{ os = "linux", arch = "arm64" }, + { os = "linux", arch = "amd64" }, + { os = "osx", arch = "arm64" }, + { os = "osx", arch = "amd64" }, + { os = "windows", arch = "arm64" }, + { os = "windows", arch = "amd64" }] +---- +-- +JSON:: ++ +-- +[source,json] +[subs="+macros"] +---- +{ + // Configures matrix variables. + // icon:dot-circle[] + "matrix": { + "vars": { + "os": [ "linux", "osx", "windows" ], + "arch": [ "arm64", "amd64" ] + }, + "rows": [ + { "os": "linux", "arch": "arm64" }, + { "os": "linux", "arch": "amd64" }, + { "os": "osx", "arch": "arm64" }, + { "os": "osx", "arch": "amd64" }, + { "os": "windows", "arch": "arm64" }, + { "os": "windows", "arch": "amd64" } + ] + } +} +---- +-- +Maven:: ++ +-- +[source,xml] +[subs="+macros,verbatim"] +---- + + + + + + linux + osx + windows + + + arm64 + amd64 + + + + + linux + arm64 + + + linux + amd64 + + + osx + arm64 + + + osx + amd64 + + + windows + arm64 + + + windows + amd64 + + + + +---- +-- +Gradle:: ++ +-- +[source,groovy] +[subs="+macros"] +---- +jreleaser { + // Configures matrix variables. + // icon:dot-circle[] + matrix { + variable(os, [ 'linux', 'osx', 'windows' ]) + variable('arch', [ 'arm64', 'amd64' ]) + + row(os: 'linux', arch: 'arm64') + row(os: 'linux', arch: 'amd64') + row(os: 'osx', arch: 'arm64') + row(os: 'osx', arch: 'amd64') + row(os: 'windows', arch: 'arm64') + row(os: 'windows', arch: 'amd64') + } +} +---- +-- +==== + +== Special Keys + +The following keys have special meaning: + +[horizontal] +platform:: Defines the platform for a given archive or artifact. + +== Example + +The following example showcases a self-contained Go project that relies on the matrix feature to configure: + +- a hook to compile the source code before assembly occurs. +- an archive assembler to pack the binaries into a distribution +- a distribution with all generated artifacts + +**jreleaser.yml** +[source,yaml] +---- +matrix: + rows: + - { goos: darwin, goarch: arm64, platform: osx-aarch_64 } + - { goos: darwin, goarch: amd64, platform: osx-x86_64 } + - { goos: linux, goarch: arm64, platform: linux-aarch_64 } + - { goos: linux, goarch: amd64, platform: linux-x86_64 } + - { goos: windows, goarch: arm64, platform: windows-aarch_64 } + - { goos: windows, goarch: amd64, platform: windows-x86_64 } + +hooks: + script: + before: + - run: | + go build -o target/${GOOS}-${GOARCH}/ src/helloworld.go + applyDefaultMatrix: true + environment: + GOOS: '{{ matrix.goos }}' + GOARCH: '{{ matrix.goarch }}' + filter: + includes: ['assemble'] + +project: + name: helloworld + description: HelloWorld in Go + longDescription: HelloWorld in Go + links: + homepage: https://github.com/jreleaser/helloworld-go + authors: + - Andres Almiray + license: MIT + inceptionYear: 2024 + stereotype: CLI + +release: + github: + name: helloworld-go + overwrite: true + changelog: + formatted: ALWAYS + preset: conventional-commits + contributors: + format: '- {{contributorName}}{{#contributorUsernameAsLink}} ({{.}}){{/contributorUsernameAsLink}}' + +assemble: + archive: + helloworld: + active: ALWAYS + formats: [ ZIP ] + applyDefaultMatrix: true + archiveName: '{{distributionName}}-{{projectVersion}}-{{ matrix.goos }}-{{ matrix.goarch }}' + fileSets: + - input: 'target/{{ matrix.goos }}-{{ matrix.goarch }}' + output: 'bin' + includes: [ 'helloworld{.exe,}' ] + - input: '.' + includes: [ 'LICENSE' ] + +distributions: + helloworld: + type: BINARY + executable: + windowsExtension: exe +---- + +Executing `jreleaser assemble` results in the following binaries compiled by the Go compiler + +[source,shell] +---- +$ tree target/ +target/ +├── darwin-amd64 +│ └── helloworld +├── darwin-arm64 +│ └── helloworld +├── linux-amd64 +│ └── helloworld +├── linux-arm64 +│ └── helloworld +├── windows-amd64 +│ └── helloworld.exe +└── windows-arm64 + └── helloworld.exe +---- + +And the following artifacts assembled by the xref:reference:assemble/archive.adoc[] assembler + +[source,shell] +---- +$ ls out/jreleaser/assemble/helloworld/archive/helloworld-1.0.0-* +out/jreleaser/assemble/helloworld/archive/helloworld-1.0.0-darwin-amd64.zip +out/jreleaser/assemble/helloworld/archive/helloworld-1.0.0-darwin-arm64.zip +out/jreleaser/assemble/helloworld/archive/helloworld-1.0.0-linux-amd64.zip +out/jreleaser/assemble/helloworld/archive/helloworld-1.0.0-linux-arm64.zip +out/jreleaser/assemble/helloworld/archive/helloworld-1.0.0-windows-amd64.zip +out/jreleaser/assemble/helloworld/archive/helloworld-1.0.0-windows-arm64.zip +---- + +The assembler will automatically configure a distribution with the following resolved artifacts: + +[source,yaml] +---- +distributions: + helloworld: + enabled: true + active: ALWAYS + type: BINARY + executable: + name: helloworld + windowsExtension: exe + platform: + artifacts: + artifact 0: + enabled: true + active: ALWAYS + path: out/jreleaser/assemble/helloworld/archive/helloworld-1.0.0-linux-arm64.zip + platform: linux-aarch_64 + artifact 1: + enabled: true + active: ALWAYS + path: out/jreleaser/assemble/helloworld/archive/helloworld-1.0.0-linux-amd64.zip + platform: linux-x86_64 + artifact 2: + enabled: true + active: ALWAYS + path: out/jreleaser/assemble/helloworld/archive/helloworld-1.0.0-darwin-arm64.zip + platform: osx-aarch_64 + artifact 3: + enabled: true + active: ALWAYS + path: out/jreleaser/assemble/helloworld/archive/helloworld-1.0.0-darwin-amd64.zip + platform: osx-x86_64 + artifact 4: + enabled: true + active: ALWAYS + path: out/jreleaser/assemble/helloworld/archive/helloworld-1.0.0-windows-arm64.zip + platform: windows-aarch_64 + artifact 5: + enabled: true + active: ALWAYS + path: out/jreleaser/assemble/helloworld/archive/helloworld-1.0.0-windows-amd64.zip + platform: windows-x86_64 + stereotype: CLI +---- \ No newline at end of file