Platforms
Curseforge

Basic example

See the following minimal example showing how to publish the remapJar task to CurseForge:

publishMods {
    file = remapJar.archiveFile
    changelog = "Changelog"
    type = STABLE
    modLoaders.add("fabric")
 
    curseforge {
        accessToken = providers.environmentVariable("CURSEFORGE_API_KEY")
        projectId = "308769"
        minecraftVersions.add("1.20.1")
    }
}
 

You will need to generate a CurseForge API token in your account settings here (opens in a new tab), you can set this an environment variable. If you plan to publish from your local machine using a Gradle user property may be more convenient:

You can use the gradle property provider like so: providers.gradleProperty('CURSEFORGE_API_KEY')

Multiple projects

You can create multiple CurseForge destinations by providing a name like so:

publishMods {
    curseforge("curseforgeProjectA") {
        // Configure curseforge settings for project A here
    }
 
    curseforge("curseforgeProjectB") {
        // Configure curseforge settings for project B here
    }
}

All options

See the following example showing all the CurseForge specific options:

publishMods {
    curseforge {
        accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")
        projectId = "123456"
        minecraftVersions.add("1.20.1")
 
        // You can specify a range of Minecraft versions like so:
        minecraftVersionRange {
            start = "1.19.4"
            end = "1.20.2" // Set to "latest" to use the latest minecraft version
        }
 
        // Optionally set the announcement title used by the discord publisher
        announcementTitle = "Download from CurseForge"
 
        // Optionally specify the java version that is required to run the mod
        javaVersions.add(JavaVersion.VERSION_17)
 
        // Optionally specify an environment that is required to run the mod
        clientRequired = true
        serverRequired = true
 
        // When using the discord webhook you must also specify the project slug
        // This is due to limitations in the CurseForge API.
        projectSlug = "test-mod"
 
        // Add dependencies to your project
        requires("project-slug-1", "another-project")
        optional("project-slug")
        incompatible("project-slug")
        embeds("project-slug")
 
        // Set a changelog using text, markdown, or html (defaults to markdown)
        changelog = "# Markdown changelog content"
        changelogType = "markdown"
    }
}