diff --git a/.github/workflows/build-artifacts.yml b/.github/workflows/build-artifacts.yml new file mode 100644 index 0000000..177631a --- /dev/null +++ b/.github/workflows/build-artifacts.yml @@ -0,0 +1,27 @@ +name: Build Artifacts + +on: [ push, pull_request ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + + - name: Grant execute permission for gradlew + run: chmod +x ./gradlew + + - name: Build with Gradle + run: ./gradlew clean build + + - name: Upload build artifacts + uses: actions/upload-artifact@v2.2.3 + with: + name: build-artifacts + path: build/libs diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d8daa0f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,40 @@ +name: Upload Release Artifacts + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + + - name: Grant execute permission for gradlew + run: chmod +x ./gradlew + + - name: Build with Gradle + run: ./gradlew clean assemble + + - name: Upload assets to Modrinth and CurseForge + uses: Kir-Antipov/mc-publish@v3.3 + with: + name: "${archivesBaseName}-${version}.jar" + version-type: release + changelog-file: changelog.* + + modrinth-featured: true + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + + curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} + + retry-attempts: 2 + retry-delay: 10000 + fail-mode: fail diff --git a/build.gradle b/build.gradle index 9ee2968..d3244e6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,15 +1,12 @@ import java.time.OffsetDateTime import java.time.ZoneOffset -import net.darkhax.curseforgegradle.TaskPublishCurseForge plugins { id 'idea' id 'eclipse' id 'maven-publish' id 'fabric-loom' version '1.3-SNAPSHOT' - id 'com.modrinth.minotaur' version '2.+' id 'org.cadixdev.licenser' version '0.6.1' - id 'net.darkhax.curseforgegradle' version '1.1.15' } archivesBaseName = mod_id @@ -145,11 +142,15 @@ java { // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task if it is present. // If you remove this line, sources will not be generated. - withSourcesJar() + if (project.hasProperty('make_sources_jar') && project.findProperty('make_sources_jar').toBoolean()) { + withSourcesJar() + } // If this mod is going to be a library, then it should also generate Javadocs in order to aid with development. // Uncomment this line to generate them. - withJavadocJar() + if (project.hasProperty('make_javadoc_jar') && project.findProperty('make_javadoc_jar').toBoolean()) { + withJavadocJar() + } } var manifestAttributes = [ @@ -208,49 +209,3 @@ license { author = mod_author } } - -modrinth { - token = project.MODRINTH_TOKEN ?: "Invalid/No Modrinth API key could be found!" // This is the default. - projectId = modrinth_project_id // This can be the project ID or the slug. Either will work! - versionNumber = version // You don't need to set this manually. Will fail if Modrinth has this version already - versionType = modrinth_release_type // This is the default -- can also be `beta` or `alpha` - versionName = "${archivesBaseName}-${version}" - changelog = rootProject.file("changelog.md").text - uploadFile = remapJar // With Loom, this MUST be set to `remapJar` instead of `jar`! - gameVersions = [minecraft_version] // Must be an array, even with only one version - loaders = ["fabric", "quilt"] // Must also be an array - no need to specify this if you're using Loom or ForgeGradle - dependencies { // A special DSL for creating dependencies - // scope.type - // The scope can be `required`, `optional`, `incompatible`, or `embedded` - // The type can either be `project` or `version` - required.project "fabric-api" // Creates a new required dependency on Fabric API - optional.project "modmenu" - } - syncBodyFrom = rootProject.file("README.md").text -} - -tasks.modrinth.dependsOn tasks.modrinthSyncBody -tasks.modrinth.dependsOn tasks.assemble - -task curseforge(type: TaskPublishCurseForge) { - apiToken = project.CURSEFORGE_TOKEN ?: "Invalid/No CurseForge API key could be found!" - - def mainFile = upload(curseforge_project_id, file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar")) - - mainFile.displayName = "${archivesBaseName}-${version}" - mainFile.releaseType = curseforge_release_type - mainFile.addModLoader("Fabric") - mainFile.addGameVersion(minecraft_version) - mainFile.addJavaVersion(curseforge_java_version) - mainFile.addRequirement('fabric-api') //Fabric API slug - mainFile.addOptional('modmenu') - mainFile.changelog = rootProject.file("changelog.md").text - mainFile.changelogType = 'text' -} - -tasks.curseforge.dependsOn tasks.assemble - -task publishToModHosts { - publishToModHosts.dependsOn modrinth - publishToModHosts.dependsOn curseforge -} diff --git a/gradle.properties b/gradle.properties index 3f60189..072d327 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,14 +5,10 @@ mod_id=kirislib mod_group=dev.tophatcat.kirislib mod_credits=KiriCattus mod_author=KiriCattus -mod_homepage=https://modrinth.com/mod/kirislib -mod_cf=https://www.curseforge.com/minecraft/mc-mods/kiris-lib mod_source=https://github.com/tophatcats-mods/kiris-lib -mod_issue_tracker=https://github.com/tophatcats-mods/kiris-lib/issues -mod_description=A library mod containing things that all my mods use to save time duplicating code that I already have. -mod_license_id=LGPL-2.1 -mod_license_long=GNU Lesser General Public License v2.1 -mod_discord=https://discord.tophatcat.dev + +make_javadoc_jar=true +make_sources_jar=true # Fabric properties fabric_aws_enabled=false @@ -22,20 +18,9 @@ fabric_loader_version=0.14.22 # Fabric API version numer is shared between all the modules. fabric_api_version=0.86.1+1.20.1 -# Modrinth properties. -modrinth_project_id=M6agkTxA -# Can also be beta or alpha -modrinth_release_type=release - -# CurseForge properties. -curseforge_project_id=280547 -#Can accept "alpha", "beta" or "release". -curseforge_release_type=release -curseforge_java_version=Java 17 +# Dependencies are managed at gradle/libs.versions.toml +modmenu_version=7.2.1 # Gradle Properties. org.gradle.jvmargs=-Xmx3G org.gradle.daemon=true - -# Dependencies are managed at gradle/libs.versions.toml -modmenu_version=7.2.1 diff --git a/src/main/resources/assets/kirislib/icon.png b/src/main/resources/assets/kirislib/logo.png similarity index 100% rename from src/main/resources/assets/kirislib/icon.png rename to src/main/resources/assets/kirislib/logo.png diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 5557e19..f76a3fd 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,37 +1,54 @@ { "schemaVersion": 1, - "id": "${mod_id}", + "id": "kirislib", "version": "${version}", - "name": "${mod_name}", - "description": "${mod_description}", - "authors": [ - "${mod_author}" - ], - "contact": { - "homepage": "${mod_homepage}", - "issues": "${mod_issue_tracker}", - "sources": "${mod_source}" - }, - "license": "${mod_license_id}", - "icon": "assets/${mod_id}/icon.png", + "name": "Kiri's Lib", + "description": "A library mod containing things that all my mods use to save time duplicating code that I already have.", + "authors": [ + { + "name": "KiriCattus", + "contact": { + "github": "KiriCattus", + "homepage": "https://tophatcat.dev" + } + } + ], + "contact": { + "homepage": "https://modrinth.com/mod/kirislib", + "issues": "https://github.com/tophatcats-mods/kiris-lib/issues", + "sources": "https://github.com/tophatcats-mods/kiris-lib" + }, + "license": "LGPL-2.1", + "icon": "assets/kirislib/logo.png", "environment": "*", "entrypoints": { "main": [ "dev.tophatcat.kirislib.KirisLib" ] }, + "depends": { - "fabricloader": ">=${fabric_loader_version}", - "minecraft": "${minecraft_version}", + "fabricloader": ">=0.14.22", + "minecraft": ">=1.20", "java": ">=17", - "fabric-api": "${fabric_api_version}" + "fabric-api": ">=0.86.1+1.20.1" }, + + "suggests": { + "modmenu": "*" + }, + "custom": { + "mc-publish": { + "loaders": ["fabric", "quilt"], + "curseforge": 280547, + "modrinth": "M6agkTxA" + }, "modmenu": { "links": { - "modmenu.discord": "${mod_discord}", - "modmenu.modrinth": "${mod_homepage}", - "modmenu.curseforge": "${mod_cf}" + "modmenu.discord": "https://discord.tophatcat.dev", + "modmenu.modrinth": "https://modrinth.com/mod/kirislib", + "modmenu.curseforge": "https://www.curseforge.com/minecraft/mc-mods/kiris-lib" }, "update_checker": true }