-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mod platform publishing task #140
Conversation
c2dc2ef
to
bc3189e
Compare
@hashalite the next release could be a good opportunity to test this out? You could merge this locally and try using it without actually merging it on GitHub. I'm happy to help worth through any teething issues with you on Discord, since I can't really test this myself without setting up Curseforge/Modrinth pages. |
I've ported over to modpublisher after our conversation earlier. Once this is tested/refined further I'll squash the commits, but I've kept it separate for now in-case we decide to revert. The issue with the fabric project not correctly configuring the requirements might be resolved by this, otherwise try putting it in an I set |
b8c111c
to
331a87e
Compare
Rebased on main, cleaned up a little & added initial changelog code. If everything works correctly, the published release should contain the changelog section related to the current If the changelog doesn't have a section for that version, then a warning should be logged and the "unreleased" section should be used instead. |
f994203
to
f313df2
Compare
I've polished a bit further and implemented the ability to list additional supported mc versions using I was able to do some limited testing by setting a dummy api key & The issue we were experiencing with modrinth dependencies should be resolved, but I can't test that. The issue with |
Run using `gradlew publishMod` Uses the modpublisher[1] plugin. [1]: https://github.com/firstdarkdev/modpublisher
Get the version's changelog from the CHANGELOG file, via JetBrain's changelog plugin.
- `minecraft_version` is always listed as supported. - `supported_mc_versions` is a comma-separated list of MC versions supported by all builds. - `*_supported_mc_versions` is a comma-separated list of MC versions supported by a specific mod loader (forge, neoforge, fabric). Only `minecraft_version` is required to exist in `gradle.properties`, the others are optional.
f313df2
to
bad3588
Compare
Bumped to modpublisher 2.0.5, so the modrinth slug->id issue should be fully resolved now. Worked correctly in my tests: "dependencies": [
{
"projectId": "P7dR8mSH",
"dependencyType": "required"
},
{
"projectId": "mOgUt4GM",
"dependencyType": "optional"
},
{
"projectId": "9s6osm5g",
"dependencyType": "embedded"
}
], A future modpublisher version will add caching for API requests, since properly supporting slug->id resolution requires calling modrinth's project API a fair bit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good, thank you!
Mod publishing
This PR adds the modpublisher plugin which simplifies the process of publishing to CurseForge & Modrinth.
For an overview, see their readme or their full documentation.
Usage
After creating a release (setting version, release type, patching changelog, committing), you will use the
publish
task.publish
is Gradle's "umbrella" task, which depends on all publishing tasks. If you only want to publish to modding platforms, you can usepublishMod
instead, or evenpublishCurseforge
&publishModrinth
to publish only to Curseforge and Modrinth respectively.Note there is also a
publishGitHub
task provided by modpublisher, however this will do nothing because we haven't configured modpublisher for GitHub Releases (see below). We can't disable the task (which would hide it) becausepublishMod
depends on it.GitHub Releases
Publishing to GitHub is not covered by this PR. That may be better achieved as part of a CI/CD setup using GitHub Actions/Workflows.
modpublisher has built-in support for publishing GitHub releases, however for our use case the "version" would need to be different and we'll probably need more control...
Secrets
API tokens/keys must be set to actually do any publishing. These can either be gradle properties (
curseforge_token
&modrinth_token
) or environment variables (CURSEFORGE_TOKEN
&MODRINTH_TOKEN
).Personally, I'd probably set these as "user" gradle properties by creating a
gradle.properties
file in theGRADLE_USER_HOME
directory (~/.gradle
orC:\Users\<USERNAME>\.gradle
). Setting up.env
is another option.Definitely do not put them in the project gradle properties, as these get committed to git 😂!
We'll also want these saved in the repo secrets if we ever setup a CI job to automate publishing.
Published Jars
The appropriate jars are published to each platform; all platforms use the normal build variant (
remapJar
) except for Modrinth, which uses the output fromremapModrinthJar
.Changelog
I haven't added anything to the changelog as this PR only affects internal (dev-facing) stuff, which is already mentioned in the changelog.
The published release will contain the changelog entry relating to the current
mod_version
.The changelog section header is omitted, because that should be self-evident from the release the changelog is attached to, however this is configurable and could be included if desired.
Alternative plugins
We initially explored using shedanial's unified-publishing, however we ran into an issue setting "embedded" related mods for the Modrinth platform. Seeing as everything we needed worked on modpublisher & that project appears to be more actively maintained, we decided to use that instead.
Original PR description
Hidden for brevity
This PR implements shedanial's unified-publishing plugin to streamline the curseforge/modrinth publishing process.
Publishing to GitHub is not covered by this PR. That may be better achieved as part of a CI/CD setup using GitHub Actions/Workflows.
That said, modpublisher has built-in support for publishing GitHub releases as part of a unified publish task, so we could consider using that instead.
API tokens/keys must be set to actually do any publishing. These can either be gradle properties (
curseforge_token
&modrinth_token
) or environment variables (CURSEFORGE_TOKEN
&MODRINTH_TOKEN
).Personally, I'd probably set these as "user" gradle properties by creating a
gradle.properties
file in theGRADLE_USER_HOME
directory (~/.gradle
orC:\Users\<USERNAME>\.gradle
). Setting up.env
is another option.Definitely do not put them in the project gradle properties, as these get committed to git 😂!
Run using
gradlew publishUnified
.I haven't tested this, since I don't have access to your tokens. It's possible I've misinterpreted what is meant by "modrinth id"; currently it's set to
"freecam"
.When testing, I'd recommend changing the
releaseType
to alpha and changingmod_version
to something like"TEST"
.Come to think of it,
releaseType
should probably be set as ingradle.properties
... Any other feedback, questions, etc welcome.Fixes #134