Update build scripts

- add publish to modrinth script
- add publish to curseforge script
- update build and release ci
- fix spelling in README.md

Signed-off-by: Lucas Petrino <nsx1lucas@gmail.com>
This commit is contained in:
2024-01-16 14:52:17 +13:00
parent 5ab33b1e63
commit b210d0540e
6 changed files with 78 additions and 6 deletions

View File

@@ -8,6 +8,8 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
CI_DEV_BUILD: true
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set up JDK 17 - name: Set up JDK 17
@@ -15,6 +17,8 @@ jobs:
with: with:
java-version: '17' java-version: '17'
distribution: 'temurin' distribution: 'temurin'
- name: Setup build number
run: echo "BUILD_NUMBER=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
- name: Make gradlew executable - name: Make gradlew executable
run: chmod +x ./gradlew run: chmod +x ./gradlew
- name: Build with Gradle - name: Build with Gradle
@@ -24,5 +28,7 @@ jobs:
- name: Upload Build Results - name: Upload Build Results
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: build name: weather-changer-build
path: build/libs/*.jar path: |
fabric/build/**/*.jar
forge/build/**/*.jar

View File

@@ -25,7 +25,9 @@ jobs:
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: build name: build
path: build/libs/*.jar path: |
fabric/build/**/*.jar
forge/build/**/*.jar
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -40,7 +42,7 @@ jobs:
- name: Create Release - name: Create Release
run: | run: |
mkdir dist mkdir dist
mv build/*.jar dist mv build/**/*.jar dist
pushd dist pushd dist
shasum -a 256 * > checksums.txt shasum -a 256 * > checksums.txt

View File

@@ -23,7 +23,7 @@ Changes the weather on client side (only visible to you) to clear, rain, or thun
The command alias `/cweather` may also be used as a shortcut. The command alias `/cweather` may also be used as a shortcut.
### Keybindings ### Keybindings
To set the keybindings you can do so in the minecraft keyBase bind settings. To set the keybindings you can do so in the minecraft keybinding settings.
| Description | Default | | Description | Default |
|----------------------------------------------------------------------------------|---------| |----------------------------------------------------------------------------------|---------|

View File

@@ -1,6 +1,13 @@
import io.github.themrmilchmann.gradle.publish.curseforge.ChangelogFormat
import io.github.themrmilchmann.gradle.publish.curseforge.GameVersion
import io.github.themrmilchmann.gradle.publish.curseforge.ReleaseType
import net.fabricmc.loom.task.RemapJarTask
plugins { plugins {
id("architectury-plugin") version "3.4-SNAPSHOT" id("architectury-plugin") version "3.4-SNAPSHOT"
id ("dev.architectury.loom") version "1.3-SNAPSHOT" apply false id ("dev.architectury.loom") version "1.3-SNAPSHOT" apply false
id("com.modrinth.minotaur") version "2.+"
id("io.github.themrmilchmann.curseforge-publish") version "0.6.1"
} }
architectury { architectury {
@@ -15,6 +22,10 @@ subprojects {
"minecraft"("com.mojang:minecraft:${properties["minecraft_version"]}") "minecraft"("com.mojang:minecraft:${properties["minecraft_version"]}")
"mappings"("net.fabricmc:yarn:${rootProject.properties["yarn_mappings"]}:v2") "mappings"("net.fabricmc:yarn:${rootProject.properties["yarn_mappings"]}:v2")
} }
tasks.named("remapJar", RemapJarTask::class) {
archiveBaseName.set(properties["archives_base_name"].toString() + archiveBaseName)
}
} }
allprojects { allprojects {
@@ -22,7 +33,12 @@ allprojects {
apply(plugin = "maven-publish") apply(plugin = "maven-publish")
apply(plugin = "architectury-plugin") apply(plugin = "architectury-plugin")
version = properties["mod_version"].toString() version = if (System.getenv("CI_DEV_BUILD")?.toBoolean() == true) {
System.getenv("BUILD_NUMBER") ?: properties["mod_version"].toString()
} else {
properties["mod_version"].toString()
}
group = properties["maven_group"].toString() group = properties["maven_group"].toString()
tasks.withType<JavaCompile> { tasks.withType<JavaCompile> {
@@ -33,4 +49,48 @@ allprojects {
tasks.withType<Jar> { tasks.withType<Jar> {
archiveBaseName.set(properties["archives_base_name"].toString()) archiveBaseName.set(properties["archives_base_name"].toString())
} }
}
modrinth {
token.set(System.getenv("MODRINTH_TOKEN"))
projectId.set("nhSHTGyl")
versionNumber.set(properties["mod_version"].toString())
versionType.set(properties["release_channel"].toString())
uploadFile.set("build/libs/weather-changer-1.0.0.jar")
gameVersions.addAll("1.20", "1.20.1", "1.20.2", "1.20.3", "1.20.4")
loaders.add("fabric")
loaders.add("forge")
dependencies {
required.project("fabric-api")
}
syncBodyFrom = rootProject.file("README.md").readText()
}
curseforge {
publications {
register("curseForge") {
projectId = "682513"
gameVersions.add(GameVersion("minecraft-1-20", "1.20"))
gameVersions.add(GameVersion("minecraft-1-20", "1.20.1"))
gameVersions.add(GameVersion("minecraft-1-20", "1.20.2"))
gameVersions.add(GameVersion("minecraft-1-20", "1.20.3"))
gameVersions.add(GameVersion("minecraft-1-20", "1.20.4"))
artifacts.register("main") {
displayName = "Weather Changer"
// TODO: read from file
releaseType = ReleaseType.BETA
changelog {
// TODO: get from git diff
format = ChangelogFormat.MARKDOWN
from(file("CHANGELOG.md"))
}
}
}
}
} }

View File

@@ -41,6 +41,8 @@ tasks {
"fabric_loader_version" to rootProject.property("fabric.loader_version") "fabric_loader_version" to rootProject.property("fabric.loader_version")
)) ))
} }
exclude("architectury.common.json")
} }
remapJar { remapJar {

View File

@@ -48,6 +48,8 @@ tasks {
"minecraft_version" to rootProject.property("minecraft_version") "minecraft_version" to rootProject.property("minecraft_version")
)) ))
} }
exclude("architectury.common.json")
} }
remapJar { remapJar {