Macports
JReleaser can generate and publish a Macports Portfile into a repository that you have access to. This packager generates port file and publishes it to a repository of your choice, however it’s your responsibility to update the official https://github.com/macports/macports-ports/ with a PR of your own.
As a reference JReleaser publishes its release using a GitHub workflow
triggered on every push to the main
branch of jreleaser/jreleaser-macports.
The macports
section specifies how the Portfile should be created.
The following artifact extensions are supported by this packager:
-
.zip
-
.dmg
Distribution Support
Distribution | Supported |
---|---|
Publication of snapshots is not allowed. |
Legend:
-
required
-
optional
-
may use environment variable
-
accepts Name Templates
#
packagers:
#
macports:
# Enables or disables Macports.
# Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
# Defaults to `NEVER`.
#
active: ALWAYS
# Let the release continue if the packager fails.
# Defaults to `false`.
#
continueOnError: true
# Custom download URL.
#
downloadUrl: https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}
# Additional properties used when evaluating templates.
#
extraProperties:
# Key will be capitalized and prefixed with `macports`, i.e, `macportsFoo`.
foo: bar
# Directory with file templates used to prepare the Macports distribution.
# Defaults to `src/jreleaser/distributions/${distribution.name}/macports`.
# If specified, path must exist.
#
templateDirectory: path/to/macports/templates
# List of template files to be skipped.
# Value may be an exact match or a regex.
#
skipTemplates:
- README.md.tpl
# Git author used to commit to the repository.
#
commitAuthor:
# Name used when authoring commits.
# Defaults to `jreleaserbot`.
#
name: jreleaserbot
# E-mail used when authoring commits.
# Defaults to `jreleaser@kordamp.org`.
#
email: jreleaser@kordamp.org
# Git repository to push the portfile to.
# Defaults are shown.
#
repository:
# Enables or disables the repository.
# Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
# Defaults to `RELEASE`.
#
active: ALWAYS
# The owner of the repository.
# Defaults to the same owner as the release repository.
#
owner: duke
# The name of the repository.
# Defaults to `macports`.
#
name: macports
# The tag associated with the portfile.
# If left unspecified, will use `{{tagName}}`.
#
tagName: '{{distributionName}} {{tagName}}'
# The target branch to use.
# May define a `JRELEASER_MACPORTS_${GIT}_BRANCH` environment variable instead.
# Defaults to the branch pointed by HEAD.
#
branch: HEAD
# Username used for authoring commits. Must have write access to the repository.
# If left unspecified, the `JRELEASER_MACPORTS_${GIT}_USERNAME`
# environment variable must be defined.
# Defaults to the same username as the release repository.
#
username: duke
# Password or OAuth token with write access to the repository.
# If left unspecified, the `JRELEASER_MACPORTS_${GIT}_TOKEN`
# environment variable must be defined.
#
token: __DO_NOT_SET_HERE__
# Message when committing to the repository.
# If left unspecified, `{{distributionName}} {{tagName}}` will be used.
#
commitMessage: '{{distributionName}} {{tagName}}'
# Name of the Macports package.
# Defaults to `${distribution.name}`.
#
packageName: app
# URL used to check the latest version.
# Defaults to `0`.
#
revision: 0
# List of categories to use.
# Defaults to `[devel]`.
#
categories:
- 'devel'
# List of maintainers.
# Accepted values described at https://guide.macports.org/#reference.keywords.maintainers
# Defaults to `[@${release.username}]`.
#
maintainers:
- 'nomaintainer'
#
[packagers.macports]
# Enables or disables Macports.
# Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
# Defaults to `NEVER`.
#
active = "ALWAYS"
# Let the release continue if the packager fails.
# Defaults to `false`.
#
continueOnError = true
# Custom download URL.
#
downloadUrl = "https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}"
# Additional properties used when evaluating templates.
#
extraProperties.foo = "bar"
# Key will be capitalized and prefixed with `macports`, i.e, `macportsFoo`.
# Directory with file templates used to prepare the Macports distribution.
# Defaults to `src/jreleaser/distributions/${distribution.name}/macports`.
# If specified, path must exist.
#
templateDirectory = "path/to/macports/templates"
# List of template files to be skipped.
# Value may be an exact match or a regex.
#
skipTemplates = [ "README.md.tpl" ]
# Git author used to commit to the repository.
# Name used when authoring commits.
# Defaults to `jreleaserbot`.
#
commitAuthor.name = "jreleaserbot"
# E-mail used when authoring commits.
# Defaults to `jreleaser@kordamp.org`.
#
commitAuthor.email = "jreleaser@kordamp.org"
# Git repository to push the portfile to.
# Defaults are shown.
# Enables or disables the repository.
# Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
# Defaults to `RELEASE`.
#
repository.active = "ALWAYS"
# The owner of the repository.
# Defaults to the same owner as the release repository.
#
repository.owner = "duke"
# The name of the repository.
# Defaults to `macports`.
#
repository.name = "macports"
# The tag associated with the portfile.
# If left unspecified, will use `{{tagName}}`.
#
repository.tagName = "{{distributionName}} {{tagName}}"
# The target branch to use.
# May define a `JRELEASER_MACPORTS_${GIT}_BRANCH` environment variable instead.
# Defaults to the branch pointed by HEAD.
#
repository.branch = "HEAD"
# Username used for authoring commits. Must have write access to the repository.
# If left unspecified, the `JRELEASER_MACPORTS_${GIT}_USERNAME`
# environment variable must be defined.
# Defaults to the same username as the release repository.
#
repository.username = "duke"
# Password or OAuth token with write access to the repository.
# If left unspecified, the `JRELEASER_MACPORTS_${GIT}_TOKEN`
# environment variable must be defined.
#
repository.token = "__DO_NOT_SET_HERE__"
# Message when committing to the repository.
# If left unspecified, `{{distributionName}} {{tagName}}` will be used.
#
repository.commitMessage = "{{distributionName}} {{tagName}}"
# Name of the Macports package.
# Defaults to `${distribution.name}`.
#
packageName = "app"
# URL used to check the latest version.
# Defaults to `0`.
#
revision = 0
# List of categories to use.
# Defaults to `[devel]`.
#
categories = ["devel"]
# List of maintainers.
# Accepted values described at https://guide.macports.org/#reference.keywords.maintainers
# Defaults to `[@${release.username}]`.
#
maintainers = ["nomaintainer"]
{
//
"packagers": {
//
"macports": {
// Enables or disables Macports.
// Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
// Defaults to `NEVER`.
//
"active": "ALWAYS",
// Let the release continue if the packager fails.
// Defaults to `false`.
//
"continueOnError": true,
// Custom download URL.
//
"downloadUrl": "https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}",
// Additional properties used when evaluating templates.
//
"extraProperties": {
// Key will be capitalized and prefixed with `macports`, i.e, `macportsFoo`.
"foo": "bar"
},
// Directory with file templates used to prepare the Macports distribution.
// Defaults to `src/jreleaser/distributions/${distribution.name}/macports`.
// If specified, path must exist.
//
"templateDirectory": "path/to/macports/templates",
// List of template files to be skipped.
// Value may be an exact match or a regex.
//
"skipTemplates": [
"README.md.tpl"
],
// Git author used to commit to the repository.
//
"commitAuthor": {
// Name used when authoring commits.
// Defaults to `jreleaserbot`.
//
"name": "jreleaserbot",
// E-mail used when authoring commits.
// Defaults to `jreleaser@kordamp.org`.
//
"email": "jreleaser@kordamp.org"
},
// Git repository to push the portfile to.
// Defaults are shown.
//
"repository": {
// Enables or disables the repository.
// Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
// Defaults to `RELEASE`.
//
"active": "ALWAYS",
// The owner of the repository.
// Defaults to the same owner as the release repository.
//
"owner": "duke",
// The name of the repository.
// Defaults to `macports`.
//
"name": "macports",
// The tag associated with the portfile.
// If left unspecified, will use `{{tagName}}`.
//
"tagName": "{{distributionName}} {{tagName}}",
// The target branch to use.
// May define a `JRELEASER_MACPORTS_${GIT}_BRANCH` environment variable instead.
// Defaults to the branch pointed by HEAD.
//
"branch": "HEAD",
// Username used for authoring commits. Must have write access to the repository.
// If left unspecified, the `JRELEASER_MACPORTS_${GIT}_USERNAME`
// environment variable must be defined.
// Defaults to the same username as the release repository.
//
"username": "duke",
// Password or OAuth token with write access to the repository.
// If left unspecified, the `JRELEASER_MACPORTS_${GIT}_TOKEN`
// environment variable must be defined.
//
"token": "__DO_NOT_SET_HERE__",
// Message when committing to the repository.
// If left unspecified, `{{distributionName}} {{tagName}}` will be used.
//
"commitMessage": "{{distributionName}} {{tagName}}"
},
// Name of the Macports package.
// Defaults to `${distribution.name}`.
//
"packageName": "app",
// URL used to check the latest version.
// Defaults to `0`.
//
"revision": 0,
// List of categories to use.
// Defaults to `[devel]`.
//
"categories": ["devel"],
// List of maintainers.
// Accepted values described at https://guide.macports.org/#reference.keywords.maintainers
// Defaults to `[@${release.username}]`.
//
"maintainers": ["nomaintainer"]
}
}
}
<jreleaser>
<!--
-->
<packagers>
<!--
-->
<macports>
<!--
Enables or disables Macports.
Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
Defaults to `NEVER`.
-->
<active>ALWAYS</active>
<!--
Let the release continue if the packager fails.
Defaults to `false`.
-->
<continueOnError>true</continueOnError>
<!--
Custom download URL.
-->
<downloadUrl>https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}</downloadUrl>
<!--
Additional properties used when evaluating templates.
-->
<extraProperties>
<!--
Key will be capitalized and prefixed with `macports`, i.e, `macportsFoo`.
-->
<foo>bar</foo>
</extraProperties>
<!--
Directory with file templates used to prepare the Macports distribution.
Defaults to `src/jreleaser/distributions/${distribution.name}/macports`.
If specified, path must exist.
-->
<templateDirectory>path/to/macports/templates</templateDirectory>
<!--
List of template files to be skipped.
Value may be an exact match or a regex.
-->
<skipTemplates>
<skipTemplate>README.md.tpl</skipTemplate>
</skipTemplates>
<!--
Git author used to commit to the repository.
-->
<commitAuthor>
<!--
Name used when authoring commits.
Defaults to `jreleaserbot`.
-->
<name>jreleaserbot</name>
<!--
E-mail used when authoring commits.
Defaults to `jreleaser@kordamp.org`.
-->
<email>jreleaser@kordamp.org</email>
</commitAuthor>
<!--
Git repository to push the portfile to.
Defaults are shown.
-->
<repository>
<!--
Enables or disables the repository.
Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
Defaults to `RELEASE`.
-->
<active>ALWAYS</active>
<!--
The owner of the repository.
Defaults to the same owner as the release repository.
-->
<owner>duke</owner>
<!--
The name of the repository.
Defaults to `macports`.
-->
<name>macports</name>
<!--
The tag associated with the portfile.
If left unspecified, will use `{{tagName}}`.
-->
<tagName>{{distributionName}} {{tagName}}</tagName>
<!--
The target branch to use.
May define a `JRELEASER_MACPORTS_${GIT}_BRANCH`` environment variable instead.
Defaults to the branch pointed by HEAD.
-->
<branch>HEAD</branch>
<!--
Username used for authoring commits. Must have write access to the repository.
If left unspecified, the `JRELEASER_MACPORTS_${GIT}_USERNAME`
environment variable must be defined.
Defaults to the same username as the release repository.
-->
<username>duke</username>
<!--
Password or OAuth token with write access to the repository.
If left unspecified, the `JRELEASER_MACPORTS_${GIT}_TOKEN`
environment variable must be defined.
-->
<token>__DO_NOT_SET_HERE__</token>
<!--
Message when committing to the repository.
If left unspecified, `{{distributionName}} {{tagName}}` will be used.
-->
<commitMessage>{{distributionName}} {{tagName}}</commitMessage>
</repository>
<!--
Name of the Macports package.
Defaults to `${distribution.name}`.
-->
<packageName>app</packageName>
<!--
URL used to check the latest version.
Defaults to `0`.
-->
<revision>0</revision>
<!--
List of categories to use.
Defaults to `[devel]`.
-->
<categories>devel</categories>
<!--
List of maintainers.
Accepted values described at https://guide.macports.org/#reference.keywords.maintainers
Defaults to `[@${release.username}]`.
-->
<maintainers>nomaintainer</maintainers>
</macports>
</packagers>
</jreleaser>
jreleaser {
//
packagers {
//
macports {
// Enables or disables Macports.
// Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
// Defaults to `NEVER`.
//
active = 'ALWAYS'
// Let the release continue if the packager fails.
// Defaults to `false`.
//
continueOnError = true
// Custom download URL.
//
downloadUrl = 'https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}'
// Additional properties used when evaluating templates.
// Key will be capitalized and prefixed with `macports`, i.e, `macportsFoo`.
//
extraProperties.put('foo', 'bar')
// Directory with file templates used to prepare the Macports distribution.
// Defaults to `src/jreleaser/distributions/${distribution.name}/macports`.
// If specified, path must exist.
//
templateDirectory = 'path/to/macports/templates'
// List of template files to be skipped.
// Value may be an exact match or a regex.
//
skipTemplate('README.md.tpl')
// Git author used to commit to the repository.
//
commitAuthor {
// Name used when authoring commits.
// Defaults to `jreleaserbot`.
//
name = 'jreleaserbot'
// E-mail used when authoring commits.
// Defaults to `jreleaser@kordamp.org`.
//
email = 'jreleaser@kordamp.org'
}
// Git repository to push the portfile to.
// Defaults are shown.
//
repository {
// Enables or disables the repository.
// Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
// Defaults to `RELEASE`.
//
active = 'ALWAYS'
// The owner of the repository.
// Defaults to the same owner as the release repository.
//
repoOwner = 'duke'
// The name of the repository.
// Defaults to `macports`.
//
name = 'macports'
// The tag associated with the portfile.
// If left unspecified, will use `{{tagName}}`.
//
tagName = '{{distributionName}} {{tagName}}'
// The target branch to use.
// May define a `JRELEASER_BRANCH` environment variable instead.
// Defaults to the branch pointed by HEAD.
//
branch = 'HEAD'
// Username used for authoring commits. Must have write access to the repository.
// If left unspecified, the `JRELEASER_MACPORTS_${GIT}_USERNAME`
// environment variable must be defined.
// Defaults to the same username as the release repository.
//
username = 'duke'
// Password or OAuth token with write access to the repository.
// If left unspecified, the `JRELEASER_MACPORTS_${GIT}_TOKEN`
// environment variable must be defined.
//
token = '__DO_NOT_SET_HERE__'
# Message when committing to the repository.
# If left unspecified, `{{distributionName}} {{tagName}}` will be used.
#
commitMessage = '{{distributionName}} {{tagName}}'
}
// Name of the Macports package.
// Defaults to `${distribution.name}`.
//
packageName = 'app'
// URL used to check the latest version.
// Defaults to `0`.
//
revision = 0
// List of categories to use.
// Defaults to `[devel]`.
//
categories = ['devel']
// List of maintainers.
// Accepted values described at https://guide.macports.org/#reference.keywords.maintainers
// Defaults to `[@${release.username}]`.
//
maintainers = ['nomaintainer']
}
}
}
Tokens
The repository token environment variable must match with the chosen Release service that is, it must be one of: |
-
JRELEASER_MACPORTS_GITHUB_TOKEN
-
JRELEASER_MACPORTS_GITLAB_TOKEN
-
JRELEASER_MACPORTS_GITEA_TOKEN
-
JRELEASER_MACPORTS_CODEBERG_TOKEN
If a matching token is not found then the releaser’s token will be used instead:
-
JRELEASER_GITHUB_TOKEN
-
JRELEASER_GITLAB_TOKEN
-
JRELEASER_GITEA_TOKEN
-
JRELEASER_CODEBERG_TOKEN
On GitHub, you can’t use the default
|
DownloadURL
JReleaser follows these rules to find the download URL to use for a given artifact:
-
if
artifact.extraProperties.macportsDownloadUrl
exists, use it. -
if
artifact.extraProperties.downloadUrl
exists, use it. -
if explicit
downloadUrl
is set onmacports
, use it. -
if
distribution.extraProperties.macportsDownloadUrl
exists, use it. -
if
distribution.extraProperties.downloadUrl
exists, use it. -
if
releaser.${git}.skipRelease
isfalse
then use the releaser’sdownloadUrl
. -
if
releaser.${git}.skipRelease
istrue
then look for a matching uploader given an extraProperty nameddownloadUrlFrom
onartifact
,distribution, `macports
(in that order). The value must be<uploaderType>:<uploaderName>
such as "artifactory:app" or "s3:uploads". -
fail if no suitable URL is found.
With no extra configuration from your side rule 6. will be chosen which is the suitable default that most projects need.
Example
Assuming the current version is 1.2.3
, and a distribution named app
, the above configuration will generate
a ports/devel/app/Porfile
file in the duke/macports
repository:
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup java 1.0
name app
version 1.2.3
revision 0
categories devel java
license Apache-2.0
maintainers @duke
platforms darwin
supported_archs noarch
description Awesome App
long_description Awesome App
homepage https://acme.com/app
master_sites https://github.com/duke/app/releases/download/v1.0.0/
use_zip yes
checksums rmd160 f7e88b1c323b5c1772ebce05837a7cfd4ceda09d \
sha256 53e89097573fb807adcf410169f117532ae17a4cd72066f9e40420eaf0d13147 \
size 6481
java.version 1.8.+
use_configure no
build {}
destroot {
set target ${destroot}${prefix}/share/java/${name}
# Create the target java directory
xinstall -m 755 -d ${target}
# Copy over the needed elements of our directory tree
foreach d { bin lib } {
copy ${worksrcpath}/${d} ${target}
}
# Remove extraneous bat files
foreach f [glob -directory ${target}/bin *.bat] {
delete ${f}
}
ln -s ../share/java/${name}/bin/app ${destroot}${prefix}/bin/app
}
livecheck.type none
AppName
JReleaser calculates the value of the containing app directory when packaging a Native Package
distribution for macOs and a .dmg
file. The default value matches {{distributionName}}.app
. If a different value were
to be needed then set the appName
extra property on the macports
packager. This property accepts Name Templates.
Skip Artifacts
If there is more than one matching artifact in a given distribution you may add a skipMacports
extra property to the target
artifact to mark it as skipped for packaging with Macports.
Templates
The default location for templates is:
src/jreleaser/distributions/<distribution-name>/macports
The following list shows the filenames that may be used to override default templates:
-
Portfile.tpl
Any additional files found in the template directories will be copied as is unless their filename ends with .tpl
in
which case Name Templates substitution will take place.
Templates may be initialized using the template
command
Skip Templates
You may skip any template files by defining a set of skip rules in the skipTemplates
property. For example, you may use
any of these expressions to skip a template named README.md.tpl
:
-
README.md.tpl
: matches the full template name -
README.md
: matches the transformed template name -
README.*
: matches using a regex
Publication to Macports
You are responsible for submitting a ticket to MacPorts for updating an existing port of adding a new port. JReleaser does not create a ticket nor a pull request for you.
Please consult the MacPorts guide to know more.