Skip to content

Commit

Permalink
Working runs in dev and set up actions
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebemish committed Mar 9, 2024
1 parent 0674c79 commit 351d01c
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 18 deletions.
125 changes: 125 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"jobs": {
"build": {
"outputs": {
"version": "${{ steps.record_version_capture_version.outputs.version }}"
},
"runs-on": "ubuntu-22.04",
"permissions": {
"contents": "write"
},
"steps": [
{
"name": "Setup Java",
"run": "echo \"JAVA_HOME=$JAVA_HOME_17_X64\" >> \"$GITHUB_ENV\""
},
{
"with": {
"fetch-depth": "0"
},
"name": "Checkout",
"uses": "actions/checkout@v4"
},
{
"with": {
"path": "**/.gradle/loom-cache",
"key": "${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}",
"restore-keys": "${{ runner.os }}-gradle-"
},
"name": "Cache",
"uses": "actions/cache@v4"
},
{
"with": {
"gradle-home-cache-cleanup": true
},
"name": "Setup Gradle",
"uses": "gradle/gradle-build-action@v3"
},
{
"uses": "fregante/setup-git-user@v2"
},
{
"name": "Tag Release",
"run": "./gradlew tagRelease",
"id": "tag_release"
},
{
"name": "Build",
"run": "./gradlew build",
"id": "build"
},
{
"run": "git push && git push --tags"
},
{
"name": "Record Version",
"run": "./gradlew recordVersion",
"id": "record_version"
},
{
"name": "Capture Recorded Version",
"run": "echo version=$(cat build/recordVersion.txt) >> \"$GITHUB_OUTPUT\"",
"id": "record_version_capture_version"
}
]
},
"publish": {
"needs": [
"build"
],
"runs-on": "ubuntu-22.04",
"permissions": {
"contents": "write"
},
"steps": [
{
"name": "Setup Java",
"run": "echo \"JAVA_HOME=$JAVA_HOME_17_X64\" >> \"$GITHUB_ENV\""
},
{
"with": {
"fetch-depth": "0",
"ref": "refs/tags/${{needs.build.outputs.version}}"
},
"name": "Checkout",
"uses": "actions/checkout@v4"
},
{
"with": {
"path": "**/.gradle/loom-cache",
"key": "${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}",
"restore-keys": "${{ runner.os }}-gradle-"
},
"name": "Cache",
"uses": "actions/cache@v4"
},
{
"with": {
"gradle-home-cache-cleanup": true
},
"name": "Setup Gradle",
"uses": "gradle/gradle-build-action@v3"
},
{
"name": "Publish",
"run": "./gradlew publish closeAndReleaseSonatypeStagingRepository",
"id": "publish",
"env": {
"GPG_SIGNING_KEY": "${{ secrets.GPG_SIGNING_KEY }}",
"GPG_KEY_PASSWORD": "${{ secrets.GPG_KEY_PASSWORD }}",
"CENTRAL_MAVEN_USER": "${{ secrets.CENTRAL_MAVEN_USER }}",
"CENTRAL_MAVEN_PASSWORD": "${{ secrets.CENTRAL_MAVEN_PASSWORD }}"
}
}
]
}
},
"name": "Release",
"concurrency": "ci-${{ github.ref }}",
"on": {
"workflow_dispatch": {

}
}
}
2 changes: 2 additions & 0 deletions buildSrc/src/main/groovy/convention.shared.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ dependencies {
}

tasks.named('groovydoc', Groovydoc) {
source sourceSets.extension.allSource
source sourceSets.transform.allSource
use = true
}

Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies {
parchment("org.parchmentmc.data:parchment-${libs.versions.parchment.minecraft.get()}:${libs.versions.parchment.mappings.get()}@zip")
}
minecraft libs.minecraft
modImplementation libs.fabric.loader
modCompileOnly libs.fabric.loader

sharedCompileOnly libs.groovybundler
sharedCompileOnly libs.jankson
Expand Down
5 changes: 1 addition & 4 deletions common/src/main/resources/mods.groovy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MultiplatformModsDotGroovy.make {
modLoader = 'gml'
loaderVersion = '[1,)'
loaderVersion = "[${libs.versions.gml},)"

license = 'LGPL-3.0-or-later'
issueTrackerUrl = 'https://github.com/GroovyMC/CommonGroovyLibrary/issues'
Expand All @@ -22,9 +22,6 @@ MultiplatformModsDotGroovy.make {
mod('neoforge') {
versionRange = ">=${environmentInfo.platformVersion}"
}
mod('gml') {
versionRange = ">=${libs.versions.gml}"
}
}

onFabric {
Expand Down
8 changes: 5 additions & 3 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ loom {
}

registrationUtils {
addDependencies false
projects {
fabric {
type 'fabric'
}
}
}
afterEvaluate {
reg.configureJarTask(tasks.jar)
}

dependencies {
mappings loom.layered() {
Expand Down Expand Up @@ -71,6 +75,7 @@ afterEvaluate {

dependencies {
compileOnly reg.loaderSpecific()
localRuntime reg.loaderSpecific()
testCompileOnly reg.loaderSpecific()
transformCompileOnly reg.loaderSpecific()
extensionCompileOnly reg.loaderSpecific()
Expand Down Expand Up @@ -99,6 +104,3 @@ loom {
}
}
}

// Publishing

4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ neoforge = "20.4.167"
fabric_loader = "0.15.3"
fabric_api = "0.92.0+1.20.4"

mdg = "2.0.0-beta.14"
mdg = "2.0.0-beta.15"
autoservice = "1.1.1"
nexuspublish = "2.0.0-rc-1"

Expand All @@ -22,7 +22,7 @@ enhancedgroovy = "0.2.0"

groovybundler = "2.1.1"
groovyduvet = "3.1.2"
gml = "5.0.0"
gml = "5.0.1"

jankson = "1.2.3"
nightconfig = "3.6.7"
Expand Down
19 changes: 16 additions & 3 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ tasks.named('gatherNeoForgePlatformDetails', AbstractGatherPlatformDetailsTask).
}

registrationUtils {
addDependencies false
projects {
neoforge {
type 'neoforge'
}
}
}
afterEvaluate {
reg.configureJarTask(tasks.jar)
}

repositories {
maven {
Expand All @@ -46,6 +50,7 @@ dependencies {

implementation libs.gml
api libs.jankson
include libs.jankson

allCompileOnly libs.jankson
allCompileOnly libs.gml
Expand All @@ -57,7 +62,9 @@ afterEvaluate {

dependencies {
compileOnly reg.loaderSpecific()
localRuntime reg.loaderSpecific()
testCompileOnly reg.loaderSpecific()
testRuntimeOnly reg.loaderSpecific()
transformCompileOnly reg.loaderSpecific()
extensionCompileOnly reg.loaderSpecific()
transformCompileOnly reg.common()
Expand All @@ -66,6 +73,15 @@ afterEvaluate {
}

loom {
mods {
cgltest {
sourceSet(sourceSets.test)
}
main {
sourceSet(sourceSets.extension)
sourceSet(sourceSets.transform)
}
}
runs {
client {
client()
Expand Down Expand Up @@ -95,6 +111,3 @@ processResources {
}
}
}

// Publishing

10 changes: 5 additions & 5 deletions neoforge/src/test/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ license = "MIT"
issueTrackerURL = "https://github.com/GroovyMC/CommonGroovyLibrary/issues"

[[mods]]
modId = "cgltest"
version = "0.2.0"
displayName = "Common Groovy Library"
description = "CGL Test"
authors = "GroovyMC"
modId = "cgltest"
version = "0.1.0"
displayName = "CGL Test"
description = "CGL Test"
authors = "GroovyMC"

0 comments on commit 351d01c

Please sign in to comment.