Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kikugie committed Nov 22, 2023
0 parents commit 90cc692
Show file tree
Hide file tree
Showing 25 changed files with 836 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Automatically build the project and run any configured tests for every push
# and submitted pull request. This can help catch issues that only occur on
# certain platforms or Java versions, and provides a first line of defence
# against bad commits.

name: build
on: [pull_request, push]

jobs:
build:
strategy:
matrix:
# Use these Java versions
java: [
17, # Current Java LTS & minimum supported by Minecraft
]
# and run on both Linux and Windows
os: [ubuntu-22.04, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- name: checkout repository
uses: actions/checkout@v3
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'microsoft'
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: build
run: ./gradlew chiseledBuild
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: build/libs/
64 changes: 64 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Automatically build the project and run any configured tests for every push
# and submitted pull request. This can help catch issues that only occur on
# certain platforms or Java versions, and provides a first line of defence
# against bad commits.

name: publish

on:
release:
types:
- published
workflow_dispatch:
inputs:
target_release_tag:
description: The tag of the release you want to append the artifact to
required: true

jobs:
changelog:
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: Update GitHub Release
uses: tubone24/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body_path: CHANGELOG.md
is_append_body: true
publish:
strategy:
matrix:
# Use these Java versions
java: [
17, # Current Java LTS & minimum supported by Minecraft
]
# and run on both Linux and Windows
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
distribution: adopt
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: build and publish
run: ./gradlew chiseledPublishMods
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: build/libs/
40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# gradle

.gradle/
build/
out/
classes/

# eclipse

*.launch

# idea

.idea/
*.iml
*.ipr
*.iws

# vscode

.settings/
.vscode/
bin/
.classpath
.project

# macos

*.DS_Store

# fabric

run/

# java

hs_err_*.log
replay_*.log
*.hprof
*.jfr
Empty file added CHANGELOG.md
Empty file.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 KikuGie

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Stonecutter template mod
169 changes: 169 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
plugins {
id "fabric-loom" version "1.4-SNAPSHOT"
id "maven-publish"
id "me.modmuss50.mod-publish-plugin" version "0.4.+"
}

archivesBaseName = property("mod.name")
version = "${property("mod.version")}+${stonecutter.current().version()}"
group = property("mod.maven_group")

base {
archivesName = archivesBaseName
}

repositories {
maven { url = "https://jitpack.io" }
exclusiveContent {
forRepository {
maven {
name = "Curseforge"
url = "https://www.cursemaven.com"
}
}
filter {
includeGroup "curse.maven"
}
}
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
filter {
includeGroup "maven.modrinth"
}
}
maven {
name = "TerraformersMC"
url "https://maven.terraformersmc.com/releases/"
}
}

dependencies {
minecraft "com.mojang:minecraft:${stonecutter.current().version()}"
mappings "net.fabricmc:yarn:${property("deps.yarn")}:v2"
modImplementation "net.fabricmc:fabric-loader:${property("deps.fabric_loader")}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${property("deps.fabric_api")}"

modApi "com.terraformersmc:modmenu:${property("deps.modmenu")}"
}

def target = ">=${project.property("mod.min_target")}- <=${project.property("mod.max_target")}"

processResources {
filesMatching("fabric.mod.json") {
expand "id": archivesBaseName,
"display": project.property("mod.display"),
"mod_version": version,
"target_minecraft": target,
"modrinth": project.property("publish.modrinth")
}
}

tasks.withType(JavaCompile).configureEach {
it.options.release = 17
}

tasks.withType(AbstractArchiveTask).configureEach {
preserveFileTimestamps = false
reproducibleFileOrder = true
}

java {
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

jar {
from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}" }
}
}

// configure the maven publication
publishing {
repositories {
maven {
name = "kikugieMaven"
url = "https://maven.kikugie.dev/releases"
credentials(PasswordCredentials)
authentication {
basic(BasicAuthentication)
}
}
}

publications {
mavenJava(MavenPublication) {
groupId = "${group}.${archivesBaseName}"
artifactId = property("mod.version")
version = stonecutter.current().version()

from components.java
}
}
}

// Create a task to collect the completed jars in the root project"s build/libs folder.
def collectJars = tasks.register("collectJars", Copy) { copy ->

def task = tasks.named("remapJar")

dependsOn(task)

copy.from task
copy.into rootProject.buildDir.path + "/libs"
}

// Set up assemble to depend on the collectJars task, so it gets run on build.
assemble {
dependsOn(collectJars)
}

if (stonecutter.current().isActiveVersion()) {
loom.runConfigs.server.ideConfigGenerated = true

rootProject.tasks.register("buildActive") {
setGroup "project"

dependsOn tasks.named("build")
}
}

publishMods {
file = remapJar.archiveFile
additionalFiles.from(remapSourcesJar.archiveFile)
displayName = "${project.property("mod.display")} ${project.property("mod.version")} for ${stonecutter.current().version()}"
version = project.version
changelog = getRootProject().file("CHANGELOG.md").text
type = STABLE
modLoaders.add("fabric")

dryRun = providers.environmentVariable("MODRINTH_TOKEN").getOrNull() == null || providers.environmentVariable("GITHUB_TOKEN").getOrNull() == null

modrinth {
projectId = project.property("publish.modrinth")
accessToken = providers.environmentVariable("MODRINTH_TOKEN")

def min = project.property("mod.min_target")
def max = project.property("mod.max_target")

if (min == max) {
minecraftVersions.add(min)
} else {
minecraftVersionRange {
start = min
end = max
}
}

requires {
slug = "fabric-api"
}
}
}
23 changes: 23 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx3G
org.gradle.parallel=true

# Mod Information
mod.repository=kikugie/template
mod.version=0.0.1
mod.name=template
mod.display=Template
mod.maven_group=dev.kikugie
mod.min_target=[VERSIONED]
mod.max_target=[VERSIONED]

# Dependencies
# https://fabricmc.net/develop
deps.yarn=[VERSIONED]
deps.fabric_loader=0.14.24
deps.fabric_api=[VERSIONED]
deps.modmenu=[VERSIONED]
deps.mixin_extras=0.2.0
deps.conditional_mixin=0.3.2

publish.modrinth=TODO
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 90cc692

Please sign in to comment.