Skip to content

Commit

Permalink
updated CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunekaer committed Jan 14, 2024
1 parent d5c6d1b commit c7b2216
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 110 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ name: Build & Release
on:
push:
tags:
- 'v*'
- "v*"

jobs:
build:
if: |
!contains(github.event.head_commit.message, '[ciskip]')
uses: nanite/workflows/.github/workflows/standard-arch-release.yml@v1
uses: nanite/workflows/.github/workflows/[email protected]
with:
java-version: 17
changelog-file: "./CHANGELOG.md"
release-to-github: false
secrets:
nanite-token: ${{ secrets.NANITE_DEPLOY }}
curse-token: ${{ secrets.CURSE_DEPLOY }}
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
6 changes: 2 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
## 2.3.9
## 77.0.0

### Fixed

- An issue causing the kill commands to not always kill all the entities and throw an error message instead.
- Mod has been rewritten and new commands had been added
79 changes: 72 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.1-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false
id "me.modmuss50.mod-publish-plugin" version "0.4.5"
}

architectury {
Expand All @@ -9,17 +10,29 @@ architectury {

subprojects {
apply plugin: "dev.architectury.loom"
apply plugin: "maven-publish"

loom {
silentMojangMappingsLicense()
}

dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
// The following line declares the mojmap mappings, you may use other mappings as well
mappings loom.officialMojangMappings()
// The following line declares the yarn mappings you may select this one as well.
// mappings "net.fabricmc:yarn:1.19.2+build.28:v2"
}

publishing {
repositories {
if (providers.environmentVariable("NANITE_TOKEN").isPresent()) {
maven {
url "https://maven.nanite.dev/releases"
credentials {
username = "nanite"
password = providers.environmentVariable("NANITE_TOKEN").get()
}
}
}
}
}
}

Expand All @@ -28,10 +41,9 @@ allprojects {
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"

ext.ENV = System.getenv()

archivesBaseName = rootProject.archives_base_name
version = "${rootProject.mod_version}-build.${ENV.GITHUB_RUN_NUMBER ?: 9999}+mc${rootProject.minecraft_version}"
version = rootProject.mod_version
group = rootProject.maven_group

repositories {
Expand All @@ -48,4 +60,57 @@ allprojects {
}
}

task curseforgePublish
publishMods {
dryRun = providers.environmentVariable("CURSE_TOKEN").getOrNull() == null
changelog = file("./CHANGELOG.md").text
version = "${mod_version}"
type = STABLE

def fabricOptions = publishOptions {
file = project.provider { project(":fabric").tasks.remapJar }.flatMap { it.archiveFile }
displayName = "[FABRIC][${minecraft_version}] ${project.name} ${mod_version}"
modLoaders.add("fabric")
}

def forgeOptions = publishOptions {
file = project.provider { project(":forge").tasks.remapJar }.flatMap { it.archiveFile }
displayName = "[FORGE][${minecraft_version}] ${project.name} ${mod_version}"
modLoaders.add("forge")
}

def curseForgeOptions = curseforgeOptions {
accessToken = providers.environmentVariable("CURSE_TOKEN")
projectId = "${curseforge_id}"
minecraftVersions.add("${minecraft_version}")
}

def modrinthOptions = modrinthOptions {
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
projectId = "${modrinth_id}"
minecraftVersions.add("${minecraft_version}")
}

curseforge("curseforgeFabric") {
from(curseForgeOptions, fabricOptions)
requires {
slug = "fabric-api"
}
}

curseforge("curseforgeForge") {
from(curseForgeOptions, forgeOptions)
}

if (providers.environmentVariable("MODRINTH_TOKEN").getOrNull() != null) {
modrinth("modrinthFabric") {
from(modrinthOptions, fabricOptions)
requires {
slug = "fabric-api"
}
}

modrinth("modrinthForge") {
from(modrinthOptions, forgeOptions)
}
}
}
14 changes: 1 addition & 13 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,8 @@ dependencies {
publishing {
publications {
mavenCommon(MavenPublication) {
artifactId = rootProject.archives_base_name + "-" + project.name
artifactId = "${rootProject.archivesBaseName}-${project.name}"
from components.java
}
}

repositories {
if (ENV.NANITE_TOKEN) {
maven {
url "https://maven.nanite.dev/releases"
credentials {
username = "nanite"
password = "${ENV.NANITE_TOKEN}"
}
}
}
}
}
41 changes: 3 additions & 38 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
id "com.matthewprenger.cursegradle" version "1.4.0"
}

architectury {
Expand Down Expand Up @@ -63,7 +62,7 @@ remapJar {
input.set shadowJar.archiveFile
dependsOn shadowJar
setArchiveClassifier(null)
setArchivesBaseName("${rootProject.archivesBaseName}-${project.name}")
setArchivesBaseName("${rootProject.archives_base_name}-${project.name}")
}

jar {
Expand All @@ -85,42 +84,8 @@ components.java {
publishing {
publications {
mavenFabric(MavenPublication) {
artifactId = rootProject.archives_base_name + "-" + project.name
artifactId = "${rootProject.archivesBaseName}-${project.name}"
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
if (ENV.NANITE_TOKEN) {
maven {
url "https://maven.nanite.dev/releases"
credentials {
username = "nanite"
password = "${ENV.NANITE_TOKEN}"
}
}
}
}
}

if (ENV.CURSE_TOKEN) {
curseforge {
apiKey = ENV.CURSE_TOKEN
project {
id = project.curseforge_id
releaseType = "beta"
addGameVersion "Fabric"
addGameVersion "${minecraft_version}"
mainArtifact(remapJar.archiveFile)
relations {
requiredDependency("architectury-api")
}
changelog = file("../CHANGELOG.md")
changelogType = 'markdown'
}
}
}


rootProject.tasks.curseforgePublish.dependsOn tasks.curseforge
}
45 changes: 5 additions & 40 deletions forge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
id "com.matthewprenger.cursegradle" version "1.4.0"
}

architectury {
Expand Down Expand Up @@ -37,7 +36,7 @@ configurations {
}

dependencies {
forge "net.minecraftforge:forge:${rootProject.forge_version}"
forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}"
modApi "dev.architectury:architectury-forge:${rootProject.architectury_version}"

common(project(path: ":common", configuration: "namedElements")) { transitive false }
Expand All @@ -47,8 +46,7 @@ dependencies {
processResources {
inputs.property "version", project.version

def forgeVersion = ((String) rootProject.forge_version).split("-").last()
def forgeBase = forgeVersion.split("\\.").first()
def forgeVersion = rootProject.forge_version

filesMatching("META-INF/mods.toml") {
expand "version": project.version,
Expand All @@ -71,7 +69,7 @@ remapJar {
input.set shadowJar.archiveFile
dependsOn shadowJar
setArchiveClassifier(null)
setArchivesBaseName("${rootProject.archivesBaseName}-${project.name}")
setArchivesBaseName("${rootProject.archives_base_name}-${project.name}")
}

jar {
Expand All @@ -93,41 +91,8 @@ components.java {
publishing {
publications {
mavenForge(MavenPublication) {
artifactId = rootProject.archives_base_name + "-" + project.name
artifactId = "${rootProject.archivesBaseName}-${project.name}"
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
if (ENV.NANITE_TOKEN) {
maven {
url "https://maven.nanite.dev/releases"
credentials {
username = "nanite"
password = "${ENV.NANITE_TOKEN}"
}
}
}
}
}

if (ENV.CURSE_TOKEN) {
curseforge {
apiKey = ENV.CURSE_TOKEN
project {
id = project.curseforge_id
releaseType = "release"
addGameVersion "Forge"
addGameVersion "${minecraft_version}"
mainArtifact(remapJar.archiveFile)
relations {
requiredDependency("architectury-api")
}
changelog = file("../CHANGELOG.md")
changelogType = 'markdown'
}
}
}

rootProject.tasks.curseforgePublish.dependsOn tasks.curseforge
}
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ minecraft_version=1.19.2
enabled_platforms=fabric,forge

archives_base_name=ToolKit
mod_version=2.3.9
mod_version=77.0.0
maven_group=com.sunekaer.mods

architectury_version=6.5.77
architectury_version=6.5.85

fabric_loader_version=0.14.21
fabric_api_version=0.76.0+1.19.2
fabric_loader_version=0.15.3
fabric_api_version=0.77.0+1.19.2

forge_version=1.19.2-43.2.8
forge_version=43.3.7
curseforge_id=324888
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit c7b2216

Please sign in to comment.