Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ jobs:
matrix: ${{ steps.read.outputs.matrix }}
steps:
- uses: actions/checkout@v4

# A jar carries the version from gradle.properties, not the tag. Without
# this, tagging v7.0.1 while mod_version still says 7.0.0 publishes 80
# files under the old version, and CurseForge files can't be replaced.
- name: Check the tag matches mod_version
if: github.event_name == 'release'
run: |
declared=$(sed -n 's/^mod_version[[:space:]]*=[[:space:]]*//p' gradle.properties | tr -d '[:space:]')
tagged=${GITHUB_REF_NAME#v}
if [ "$declared" != "$tagged" ]; then
echo "::error::release ${GITHUB_REF_NAME} would publish mod_version ${declared}; bump gradle.properties or retag"
exit 1
fi

- id: read
run: echo "matrix=$(jq -c . .github/targets.json)" >> "$GITHUB_OUTPUT"

Expand All @@ -31,7 +45,11 @@ jobs:
strategy:
# Uploads are independent; one bad target shouldn't cancel the rest.
fail-fast: false
max-parallel: 1
# Each job decompiles its own Minecraft, so a target costs minutes, and
# there are 80 of them - serial uploads would run most of a day. Four at
# a time matches the build workflow's headroom against Maven Central and
# stays well inside both platforms' upload rate limits.
max-parallel: 4
matrix:
target: ${{ fromJson(needs.targets.outputs.matrix) }}
steps:
Expand Down
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,22 @@ Then build it. If an API moved, the compiler will say so, and the fix is another

Releases go to Modrinth and CurseForge from `.github/workflows/publish.yml`,
driven by [mod-publish-plugin](https://github.com/modmuss50/mod-publish-plugin).
One-time setup:

1. Put the project IDs in `gradle.properties` (`modrinth_id`, `curseforge_id`).
An empty ID makes that platform get skipped rather than fail.
2. Add `MODRINTH_TOKEN` and `CURSEFORGE_TOKEN` as repository secrets.

Publishing a GitHub release then uploads every target, using the release body as
the changelog. To rehearse it, run the workflow manually with `dry_run` ticked —
that builds and validates the uploads without sending anything.
Both are wired up: the project IDs are in `gradle.properties` (`modrinth_id`,
`curseforge_id`) and the `MODRINTH_TOKEN` and `CURSEFORGE_TOKEN` secrets are set
on the repository. Clearing an ID makes that platform get skipped rather than
fail.

To cut a release:

1. Bump `mod_version` in `gradle.properties` and push it.
2. Run the workflow manually with `dry_run` ticked. That builds and validates
every upload without sending anything.
3. Tag and publish a GitHub release as `v<mod_version>`. The release body
becomes the changelog on both platforms.

The tag has to match `mod_version`, and the workflow stops before uploading
anything if it doesn't — a jar carries the version it was built with, and a
file published to CurseForge can't be replaced afterwards.

## License

Expand Down
9 changes: 5 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ mod_homepage = https://www.curseforge.com/minecraft/mc-mods/cleancut
mod_sources = https://github.com/Rongmario/CleanCut
mod_issues = https://github.com/Rongmario/CleanCut/issues

# Publishing targets. Fill these in before the first release; an empty slot
# makes `publishMods` skip that platform instead of failing.
modrinth_id =
curseforge_id =
# Publishing targets. An empty slot makes `publishMods` skip that platform
# instead of failing. Tokens come from the MODRINTH_TOKEN and CURSEFORGE_TOKEN
# environment variables, set as repository secrets for the Publish workflow.
modrinth_id = CCNUnbXG
curseforge_id = 392805

fabric_loader_version = 0.16.14
Loading