diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6a95c4a..139c273 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,7 +35,8 @@ jobs: run: chmod +x ./gradlew - name: Build # run: ./gradlew build neoforge:publishGithub fabric:publishGithub --stacktrace - run: ./gradlew build neoforge:publishGithub neoforge:publishModrinth neoforge:publishCurseforge fabric:publishGithub fabric:publishModrinth fabric:publishCurseforge --stacktrace + run: ./gradlew build neoforge:publishGithub neoforge:publishModrinth fabric:publishGithub fabric:publishModrinth --stacktrace +# run: ./gradlew build neoforge:publishGithub neoforge:publishModrinth neoforge:publishCurseforge fabric:publishGithub fabric:publishModrinth fabric:publishCurseforge --stacktrace env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} diff --git a/build.gradle b/build.gradle index ba157e6..6524320 100644 --- a/build.gradle +++ b/build.gradle @@ -43,15 +43,26 @@ subprojects { displayName = "v${mod_version}-${capsLoader(project.name)}" modLoaders.addAll(project.property("release_mod_loaders_${project.name}").split(",")) maxRetries = 5 + boolean missingToken = false + github { - dryRun = providers.environmentVariable("GITHUB_TOKEN").getOrNull() == null - accessToken = providers.environmentVariable("GITHUB_TOKEN") - parent project(":").tasks.named("publishGithub") + String token = providers.environmentVariable("GITHUB_TOKEN").getOrNull() + missingToken = (missingToken || token == null || token.isBlank()) + accessToken = token + repository = github_repo + commitish = grgitService.service.get().grgit.branch.current().name + tagName = "v${mod_version}-${capsLoader(project.name)}" additionalFiles.from(sourcesJar.archiveFile) + String versions = "## Minecraft Versions\n" + project.property("release_game_versions_${project.name}").split(",").each { + versions = "${versions}\n- ${it}" + } + changelog = versions + "\n\n## Changelog\n\n" + versionChangelog() } modrinth { - dryRun = providers.environmentVariable("MODRINTH_TOKEN").getOrNull() == null - accessToken = providers.environmentVariable("MODRINTH_TOKEN") + String token = providers.environmentVariable("MODRINTH_TOKEN").getOrNull() + missingToken = (missingToken || token == null || token.isBlank()) + accessToken = token projectId = modrinth_id minecraftVersions.addAll(project.property("release_game_versions_${project.name}").split(",")) changelog = versionChangelog() @@ -79,8 +90,9 @@ subprojects { projectDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText } curseforge { - dryRun = providers.environmentVariable("CURSEFORGE_TOKEN").getOrNull() == null - accessToken = providers.environmentVariable("CURSEFORGE_TOKEN") + String token = providers.environmentVariable("CURSEFORGE_TOKEN").getOrNull() + missingToken = (missingToken || token == null || token.isBlank()) + accessToken = token projectId = curseforge_id projectSlug = curseforge_slug minecraftVersions.addAll(project.property("release_game_versions_${project.name}").split(",")) @@ -106,35 +118,12 @@ subprojects { } } } + dryRun = missingToken } } } } -publishMods { - // This task is necessary to allow publishing files from multiple - // subprojects to a single GitHub release. - version = mod_version - type = me.modmuss50.mpp.ReleaseType.of(release_type) - github { - dryRun = providers.environmentVariable("GITHUB_TOKEN").getOrNull() == null - accessToken = providers.environmentVariable("GITHUB_TOKEN") - repository = github_repo - commitish = grgitService.service.get().grgit.branch.current().name - tagName = "v${mod_version}" - allowEmptyFiles = true - // Include compatible MC version lists in description - String versions = "## MC versions\n\n" - if (project.hasProperty("release_game_versions_fabric")) - versions = String.format("%s - Fabric: %s\n", versions, - project.property("release_game_versions_fabric")) - if (project.hasProperty("release_game_versions_neoforge")) - versions = String.format("%s - NeoForge: %s\n", versions, - project.property("release_game_versions_neoforge")) - changelog = versions + "\n\n## Changelog\n\n" + versionChangelog() - } -} - String versionChangelog() { List lines = rootProject.file("CHANGELOG.md").readLines() StringBuilder builder = new StringBuilder()