Skip to content

Commit

Permalink
ci: upload correct binaries to mod platforms with changelog (#32)
Browse files Browse the repository at this point in the history
ci: change Java distribution to `temurin` from `adopt`
  • Loading branch information
axieum committed Jun 10, 2022
1 parent 69d4625 commit becb450
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .github/release-please.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"packages": {
".": {
"component": "fabric-example-mod",
"include-component-in-tag": false
"include-component-in-tag": false,
"pull-request-title-pattern": "chore: release v${version}"
},
"example-submod": {
"component": "example-submod"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/setup-java@v2
with:
java-version: 17
distribution: adopt
distribution: temurin

- name: 🐘 Set up Gradle
uses: gradle/gradle-build-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
uses: actions/setup-java@v2
with:
java-version: 17
distribution: adopt
distribution: temurin

- name: 🐘 Set up Gradle
uses: gradle/gradle-build-action@v2
Expand Down
30 changes: 20 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ allprojects {
maven { name 'Fabric'; url 'https://maven.fabricmc.net/' }
maven { name 'TerraformersMC'; url 'https://maven.terraformersmc.com/' }
}

// Read the `CHANGELOG.md` for the project version's changelog notes if present
ext.getChangelogNotes = { ->
final File changelog = project.file("CHANGELOG.md")
if (changelog.canRead()) {
def match = changelog.text =~ "(?ms)^## \\[\\Q${project.version}\\E].*?(?=^## |\\Z)"
if (match.find() && !match.group().isBlank()) return match.group().trim()
}
return "For a list of changes, please refer to https://github.com/${project.github_repo}/releases/tag/v${project.version}"
}
}

// Define how artifacts are published to CurseForge (https://curseforge.com)
Expand All @@ -96,18 +106,18 @@ curseforge {
// Set the release type
releaseType = project.version.contains('alpha') ? 'alpha' : project.version.contains('beta') ? 'beta' : 'release'
// Set the release notes
changelog = "For a list of changes, please refer to https://github.com/${project.github_repo}/releases/tag/v${project.version}"
changelog = project.getChangelogNotes()
// Add all supported game versions
project.cf_game_versions.split(', ').each { addGameVersion it }
// Add the main artifact
mainArtifact(remapJar) { displayName = "${project.mod_name} v${project.version} for Minecraft ${project.minecraft_version}" }
// Add any additional artifacts
addArtifact sourcesJar
addArtifact jar
addArtifact remapSourcesJar
addArtifact javadocJar
subprojects.each {
addArtifact it.remapJar
addArtifact it.sourcesJar
addArtifact it.jar
addArtifact it.remapSourcesJar
addArtifact it.javadocJar
}
// Add any dependencies
relations {
Expand Down Expand Up @@ -142,20 +152,20 @@ modrinth {
// Set the release version
versionNumber = project.version
// Set the release notes
changelog = "For a list of changes, please refer to https://github.com/${project.github_repo}/releases/tag/v${project.version}"
changelog = project.getChangelogNotes()
// Add all supported mod loaders
loaders = ['fabric']
// Add all supported game versions
project.mr_game_versions.split(', ').each { gameVersions.add it }
// Add the main artifact
uploadFile = remapJar
// Add any additional artifacts
additionalFiles.add sourcesJar
additionalFiles.add jar
additionalFiles.add remapSourcesJar
additionalFiles.add javadocJar
subprojects.each {
additionalFiles.add it.remapJar
additionalFiles.add it.sourcesJar
additionalFiles.add it.jar
additionalFiles.add it.remapSourcesJar
additionalFiles.add it.javadocJar
}
// Add any dependencies
if (project.mr_relations_required) dependencies.addAll project.mr_relations_required.split(', ').collect { new ModDependency(it, 'required') }
Expand Down

0 comments on commit becb450

Please sign in to comment.