Skip to content

Commit

Permalink
Updated CI / Build Script
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunekaer committed Aug 3, 2023
1 parent b03a71e commit 40abd1e
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 27 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ jobs:
build:
if: |
!contains(github.event.head_commit.message, '[ciskip]')
uses: nanite/workflows/.github/workflows/standard-release.yml@v1
uses: nanite/workflows/.github/workflows/[email protected]
with:
java-version: 17
changelog-file: "./CHANGELOG.md"
release-to-github: false
release-files: "./build/libs/*.jar"
secrets:
nanite-token: ${{ secrets.NANITE_DEPLOY }}
curse-token: ${{ secrets.CURSE_DEPLOY }}
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Changelog

Build on 1.20.1
- Updated CI / Build Script
59 changes: 37 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
plugins {
id "dev.architectury.loom" version "0.12.0-SNAPSHOT"
id 'maven-publish'
id "com.matthewprenger.cursegradle" version "1.4.0"
id "me.modmuss50.mod-publish-plugin" version "0.3.0"
}

apply {
from 'https://files.saps.dev/ci/git-md-changelog.gradle'
}
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17

def ENV = System.getenv()

version = "${mod_version}-build.${ENV.GITHUB_RUN_NUMBER ?: 9999}+mc${minecraft_version}"
group = 'com.sunekaer.mods'
archivesBaseName = 'Mute'

java.toolchain.languageVersion = JavaLanguageVersion.of(17)

loom {
silentMojangMappingsLicense()

Expand Down Expand Up @@ -69,35 +64,55 @@ java {
publishing {
publications {
mavenForge(MavenPublication) {
artifactId = rootProject.archivesBaseName
artifactId = rootProject.archives_base_name + "-" + project.name
from components.java
}
}

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

if (ENV.CURSE_TOKEN) {
curseforge {
apiKey = ENV.CURSE_TOKEN
project {
id = project.curseforge_id
releaseType = project.curseforge_type
addGameVersion "Forge"
addGameVersion project.minecraft_version
mainArtifact(remapJar.archivePath)
changelog = file("./CHANGELOG.md")
changelogType = 'markdown'
publishMods {
dryRun = providers.environmentVariable("CURSE_TOKEN").getOrNull() == null
changelog = file("./CHANGELOG.md").text
version = "${mod_version}"
type = STABLE

def forgeOptions = publishOptions {
file = project.provider { project.tasks.remapJar }.flatMap { it.archiveFile }
displayName = "${project.name} Forge ${mod_version}+mc${minecraft_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("curseforgeForge") {
from(curseForgeOptions, forgeOptions)
}

if (providers.environmentVariable("MODRINTH_TOKEN").getOrNull() != null) {
modrinth("modrinthForge") {
from(modrinthOptions, forgeOptions)
}
}
}
8 changes: 6 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
org.gradle.jvmargs=-Xmx4G
org.gradle.daemon=false
loom.platform=forge
mod_version=2.0.0
mod_version=2.0.1
minecraft_version=1.20.1
forge_version=47.0.4
archives_base_name=mute

# Publishing
curseforge_id=625183
curseforge_type=release
modrinth_id=DqmgBVPB
maven_url=https://maven.nanite.dev/
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip

0 comments on commit 40abd1e

Please sign in to comment.