Basic example
See the following minimal example showing how to publish the remapJar
task to Gitea:
publishMods {
file = remapJar.archiveFile
changelog = "Changelog"
type = STABLE
modLoaders.add("fabric")
gitea {
accessToken = providers.environmentVariable("GITEA_TOKEN")
hostUrl(new URI("https://gitea.example.com")) // This is the link for your Gitea host.
repository = "Example/MyMod"
commitish = "main" // This is the branch the release tag will be created from
}
}
Multiple releases
You can create multiple Gitea destinations by specifying a name like so:
publishMods {
gitea("giteaProjectA") {
// Configure gitea settings for project A here
}
gitea("giteaProjectB") {
// Configure gitea settings for project B here
}
}
This will create 2 separate Gitea releases.
Parent releases
If you wish to upload files to a Gitea release created by another task either in the same project or another subproject, you can use the parent
option.
This is useful where you have multiple subprojects that you want to publish to a single release, the following example shows how a root project can create the release and subprojects can upload files to it:
Root project
publishMods {
gitea {
accessToken = providers.environmentVariable("GITEA_TOKEN")
repository = "Example/MyMod"
commitish = "main"
tagName = "release/1.0.0"
// Allow the release to be initially created without any files.
allowEmptyFiles = true
}
}
Subproject
When using the parent
option, only the accessToken
and files are required, the other options are forcefully inherited from the parent task.
publishMods {
gitea {
accessToken = providers.environmentVariable("GITEA_TOKEN")
// Specify the root project's gitea task to upload files to
parent project(":").tasks.named("gitea")
}
}
All options
See the following example showing all the Gitea specific options:
publishMods {
gitea {
accessToken = providers.environmentVariable("GITEA_TOKEN")
hostUrl(new URI("https://gitea.example.com"))
repository = "Example/MyMod"
commitish = "main"
tagName = "release/1.0.0"
// Optionally set the announcement title used by the discord publisher
announcementTitle = "Download from Gitea"
// Optionally set the display name for your host, which is used by the discord publisher if no custom title is set
hostDisplayName = "Example"
// Optionally set the brand color used by your host
hostBrandColor = 0x1d8f4a
// Upload the files to a previously created release, by providing another gitea publish task
// This is useful in multi-project builds where you want to publish multiple subprojects to a single release
parent tasks.named("publishGitea")
// Optionally allow the release to be created without any attached files.
// This is useful when you have subprojects using the parent option that you want to publish a single release.
allowEmptyFiles = true
}
}