Skip to content

Commit

Permalink
Changed gradle stuff, setup publish action
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucraft committed Jan 26, 2024
1 parent 7ef3582 commit 169ace3
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 16 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build and Release (1.20)

on:
push:
branches:
- "1.20/main"

jobs:
build:
name: "Build and Release"
runs-on: ubuntu-20.04

permissions:
contents: write
steps:
- uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: 17
distribution: 'temurin'

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- run: chmod +x gradlew

- name: Build Version
uses: gradle/gradle-build-action@v2
with:
arguments: build --stacktrace --no-daemon

- name: Setting mod version
run: |
cat $GITHUB_WORKSPACE/gradle.properties | grep ^archives_base_name= >> $GITHUB_ENV
cat $GITHUB_WORKSPACE/gradle.properties | grep ^minecraft_version= >> $GITHUB_ENV
cat $GITHUB_WORKSPACE/gradle.properties | grep ^mod_version= >> $GITHUB_ENV
- name: Publish to Maven
uses: gradle/gradle-build-action@v2
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
with:
arguments: publish --stacktrace --no-daemon
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.3-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false
}

architectury {
Expand Down Expand Up @@ -29,7 +29,7 @@ allprojects {
apply plugin: "maven-publish"

archivesBaseName = rootProject.archives_base_name
version = "${rootProject.minecraft_version}-${rootProject.mod_version}" as Object
version = "${rootProject.mod_version}+${rootProject.minecraft_version}" as Object
group = rootProject.maven_group

repositories {
Expand Down
12 changes: 8 additions & 4 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ architectury {

loom {
accessWidenerPath = file("src/main/resources/palladiumcore.accesswidener")

mixin {
defaultRefmapName = "palladiumcore-common-refmap.json"
}
}

dependencies {
Expand All @@ -14,17 +18,17 @@ dependencies {
publishing {
publications {
mavenCommon(MavenPublication) {
artifactId = rootProject.archives_base_name
artifactId = rootProject.archives_base_name + "-" + project.name
from components.java
}
}

repositories {
maven {
url 'https://repo.repsy.io/mvn/lucraft/threetag'
url 'https://maven.threetag.net'
credentials {
username System.getenv('REPSY_USERNAME')
password System.getenv('REPSY_PASSWORD')
username System.getenv('MAVEN_USERNAME')
password System.getenv('MAVEN_PASSWORD')
}
}
}
Expand Down
21 changes: 18 additions & 3 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ architectury {

loom {
accessWidenerPath = project(":common").loom.accessWidenerPath

runConfigs.configureEach {
if (name == "client") {
runDir = "../run"

if (System.getenv('MC_USERNAME') && System.getenv('MC_UUID') && System.getenv('MC_ACCESS_TOKEN')) {
programArgs '--username', System.getenv('MC_USERNAME'), '--uuid', System.getenv('MC_UUID'), '--accessToken', System.getenv('MC_ACCESS_TOKEN')
}
} else if (name == "server")
runDir = "../run/server-fabric"
}

mixin {
defaultRefmapName = "palladiumcore-fabric-refmap.json"
}
}

configurations {
Expand Down Expand Up @@ -75,10 +90,10 @@ publishing {

repositories {
maven {
url 'https://repo.repsy.io/mvn/lucraft/threetag'
url 'https://maven.threetag.net'
credentials {
username System.getenv('REPSY_USERNAME')
password System.getenv('REPSY_PASSWORD')
username System.getenv('MAVEN_USERNAME')
password System.getenv('MAVEN_PASSWORD')
}
}
}
Expand Down
36 changes: 33 additions & 3 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,31 @@ architectury {
loom {
accessWidenerPath = project(":common").loom.accessWidenerPath

runConfigs.configureEach {
if (name == "client") {
runDir = "../run"

if (System.getenv('MC_USERNAME') && System.getenv('MC_UUID') && System.getenv('MC_ACCESS_TOKEN')) {
programArgs '--username', System.getenv('MC_USERNAME'), '--uuid', System.getenv('MC_UUID'), '--accessToken', System.getenv('MC_ACCESS_TOKEN')
}
} else if (name == "server") {
runDir = "../run/server-forge"
} else if (name == "data") {
programArgs '--existing', project(":common").file("src/main/resources/").absolutePath
}
}

forge {
convertAccessWideners = true
extraAccessWideners.add loom.accessWidenerPath.get().asFile.name

mixinConfig "palladiumcore-common.mixins.json"
mixinConfig "palladiumcore.mixins.json"
}

mixin {
defaultRefmapName = "palladiumcore-forge-refmap.json"
}
}

configurations {
Expand Down Expand Up @@ -64,6 +82,18 @@ remapJar {
}

jar {
manifest {
attributes([
"Specification-Title" : project.mod_id,
"Specification-Vendor" : project.mod_author,
"Specification-Version" : "1",
"Implementation-Title" : project.name,
"Implementation-Version" : version,
"Implementation-Vendor" : project.mod_author,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}

archiveClassifier = "dev"
}

Expand All @@ -89,10 +119,10 @@ publishing {

repositories {
maven {
url 'https://repo.repsy.io/mvn/lucraft/threetag'
url 'https://maven.threetag.net'
credentials {
username System.getenv('REPSY_USERNAME')
password System.getenv('REPSY_PASSWORD')
username System.getenv('MAVEN_USERNAME')
password System.getenv('MAVEN_PASSWORD')
}
}
}
Expand Down
11 changes: 9 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
org.gradle.jvmargs=-Xmx2048M

# MC/Arch Settings
minecraft_version=1.20.1
enabled_platforms=fabric,forge
mappings=1.20.1:2023.09.03

archives_base_name=PalladiumCore
mod_version=1.6.0.0
# Mod Settings
archives_base_name=palladiumcore
mod_id=palladiumcore
mod_version=1.0.0
mod_author=Lucraft
maven_group=net.threetag

# Common Dependencies
architectury_version=9.1.12

# Fabric Dependencies
fabric_loader_version=0.15.3
fabric_api_version=0.91.0+1.20.1

# Forge Dependencies
forge_version=1.20.1-47.1.84
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.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ include("common")
include("fabric")
include("forge")

rootProject.name = "PalladiumCore"
rootProject.name = "palladiumcore"

0 comments on commit 169ace3

Please sign in to comment.