Skip to content

Commit

Permalink
Backport Gradle Changes (#145)
Browse files Browse the repository at this point in the history
* Backport Gradle Changes

* Backport WorkFlow

* Update Example Gradle

* bump example pack.mcmeta

* Change fromTag to 3.0.1
  • Loading branch information
JT122406 authored Jan 3, 2024
1 parent 66ffc55 commit d70d203
Show file tree
Hide file tree
Showing 20 changed files with 210 additions and 187 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish

on:
workflow_dispatch:
push:

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'oracle'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Publish
run: ./gradlew publish
env:
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
BUILD_NUMBER: ${{ github.run_number }}
- name: CurseForge Publish
run: ./gradlew curseforge -PcurseApiKey=${CURSE_API_KEY}
env:
CURSE_API_KEY: ${{ secrets.CURSE_API_KEY }}
BUILD_NUMBER: ${{ github.run_number }}
continue-on-error: true
- name: Modrinth Publish
run: ./gradlew modrinth -PmodrinthToken=${MODRINTH_TOKEN}
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
BUILD_NUMBER: ${{ github.run_number }}
continue-on-error: true
15 changes: 5 additions & 10 deletions Common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
plugins {
id 'java'
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT'
id 'maven-publish'
}

archivesBaseName = "${mod_name}-common"
base.archivesName.set("${mod_name}-common")

minecraft {
accessWideners(project.file("src/main/resources/terrablender.accesswidener"))
Expand All @@ -24,7 +22,7 @@ minecraft {

dependencies {
compileOnly group:'org.spongepowered', name: 'mixin', version: '0.8.5'
compileOnly group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
compileOnly group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
compileOnly("com.electronwill.night-config:toml:${nightconfig_version}")
compileOnly("com.electronwill.night-config:core:${nightconfig_version}")
}
Expand Down Expand Up @@ -75,13 +73,10 @@ publishing {
}
repositories {
maven {
url "https://maven.minecraftforge.net/releases/"
authentication {
basic(BasicAuthentication)
}
url = "https://maven.minecraftforge.net/releases/"
credentials {
username = System.env.MAVEN_USER ?:'fake'
password = System.env.MAVEN_PASSWORD ?:'news'
username = System.getenv("MAVEN_USER")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Common/src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"description": "Resources used for TerraBlender",
"pack_format": 10
"pack_format": 15
}
}
4 changes: 2 additions & 2 deletions Example/Fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'fabric-loom' version '1.4-SNAPSHOT'
id 'idea'
}

Expand Down Expand Up @@ -35,4 +35,4 @@ loom {
runDir("run")
}
}
}
}
Binary file modified Example/Fabric/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion Example/Fabric/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-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion Example/Fabric/src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"description": "Resources used for test",
"pack_format": 8
"pack_format": 15
}
}
19 changes: 5 additions & 14 deletions Example/Forge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net/' }
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.+', changing: true
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
}
plugins {
id "net.minecraftforge.gradle" version "6.+"
id "org.spongepowered.mixin" version "0.7-SNAPSHOT"
id "java"
id "idea"
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'idea'
apply plugin: 'org.spongepowered.mixin'

group "test"
archivesBaseName = "Test-forge"

Expand Down
Binary file modified Example/Forge/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion Example/Forge/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-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion Example/Forge/src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"description": "Resources used for test",
"pack_format": 8
"pack_format": 15
}
}
58 changes: 22 additions & 36 deletions Fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
plugins {
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'maven-publish'
id 'idea'
id "fabric-loom" version "1.4-SNAPSHOT"
id "com.matthewprenger.cursegradle" version "1.4.0"
id "com.modrinth.minotaur" version "2.7.+"
id "com.modrinth.minotaur" version "2.+"
}

archivesBaseName = "${mod_name}-fabric"
def mod_build_version = "${mod_version}.${System.getenv().BUILD_NUMBER}"
base.archivesName.set("${mod_name}-fabric")

dependencies {
minecraft "com.mojang:minecraft:${minecraft_version}"
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
compileOnly project(":Common")
include implementation("com.electronwill.night-config:toml:${nightconfig_version}")
include implementation("com.electronwill.night-config:core:${nightconfig_version}")
Expand Down Expand Up @@ -43,9 +40,9 @@ processResources {
inputs.property "version", project.version

filesMatching("fabric.mod.json") {
expand "version": mod_build_version
expand "version": mod_version
}

filesMatching("${mod_id}.mixins.json") {
expand "refmap_target": "${archivesBaseName}-"
}
Expand All @@ -61,13 +58,8 @@ jar {
}
}

def changelog_file = rootProject.file("build/TerraBlender-${version}-changelog.txt")

curseforge {
if (project.hasProperty('curseApiKey')) {
apiKey = project.getProperty('curseApiKey')
}

apiKey = project.findProperty('curseApiKey') ?: 'unset'
project {
id = '565956'

Expand All @@ -78,6 +70,7 @@ curseforge {
releaseType = release_channel
addGameVersion minecraft_version
addGameVersion 'Fabric'
addGameVersion 'Quilt'

mainArtifact(remapJar) {
displayName = "TerraBlender Fabric ${version}"
Expand All @@ -94,26 +87,22 @@ curseforge {
}

modrinth {
if (project.hasProperty('modrinthToken')) {
token = project.getProperty('modrinthToken')
}
token = project.findProperty('modrinthToken')
projectId = "terrablender"
versionNumber = mod_build_version
versionName = mod_build_version + " for Fabric " + minecraft_version
versionNumber = mod_version
versionName = mod_version + " for Fabric " + minecraft_version
versionType = release_channel // can be release, beta, or alpha
uploadFile = remapJar
gameVersions = [ minecraft_version ]
loaders = [ 'fabric' ]
gameVersions = [minecraft_version]
loaders = ['fabric', 'quilt']

if (changelog_file.exists()) {
def changelog_text = changelog_file.text
changelog = "```\n" + changelog_text.substring(0, changelog_text.indexOf("=========")).replace("\t", " ") + "```"
changelog = trimChangelog(changelog_file.text)
}

dependencies {
required.project "fabric-api"
}
// debugMode = true
}

publishing {
Expand Down Expand Up @@ -153,15 +142,12 @@ publishing {
}
}
repositories {
maven {
url "https://maven.minecraftforge.net/releases/"
authentication {
basic(BasicAuthentication)
}
credentials {
username = System.env.MAVEN_USER ?:'fake'
password = System.env.MAVEN_PASSWORD ?:'news'
}
}
maven {
url = "https://maven.minecraftforge.net/releases/"
credentials {
username = System.getenv("MAVEN_USER")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
}
Loading

0 comments on commit d70d203

Please sign in to comment.