Skip to content

Commit

Permalink
Initial Commit: concept works
Browse files Browse the repository at this point in the history
  • Loading branch information
StartsMercury committed Oct 3, 2024
0 parents commit 154cf58
Show file tree
Hide file tree
Showing 21 changed files with 846 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

41 changes: 41 additions & 0 deletions .github/workflows/build-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: build-commit
on: [ push ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Extract Current Branch Name
shell: bash
# bash pattern expansion to grab the branch name without the slashes
run: ref="${GITHUB_REF#refs/heads/}" && echo "branch=${ref////-}" >> $GITHUB_OUTPUT
id: ref

- name: Checkout Repository
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3

- name: Make Gradle Wrapper Executable
run: chmod +x ./gradlew

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: gradle

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Gradle Build
run: ./gradlew build

- name: Capture Build Artifacts
uses: actions/upload-artifact@v4
with:
name: visual-snowy-leaves-artifacts-${{ steps.ref.outputs.branch }}
path: build/libs/*.jar
29 changes: 29 additions & 0 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: build-pull-request
on: [ pull_request ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3

- name: Make Gradle Wrapper Executable
run: chmod +x ./gradlew

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: gradle

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Gradle Build
run: ./gradlew build
47 changes: 47 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: build-release
on:
release:
types:
- published

jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3

- name: Make Gradle Wrapper Executable
run: chmod +x ./gradlew

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: gradle

- name: Build
run: ./gradlew clean remapJar remapSourcesJar --refresh-dependencies --rerun -Pbuild.release=true

- name: Upload Binaries to GitHub Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/libs/*.jar
file_glob: true

- name: Upload Binaries to Modrinth
uses: Kir-Antipov/[email protected]
with:
modrinth-id: Ff2M7Ii7
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
game-version-filter: none
44 changes: 44 additions & 0 deletions .github/workflows/build-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: build-tag
on:
push:
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Extract Current Branch Name
shell: bash
# bash pattern expansion to grab the branch name without the slashes
run: ref="${GITHUB_REF#refs/heads/}" && echo "branch=${ref////-}" >> $GITHUB_OUTPUT
id: ref

- name: Checkout Repository
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3

- name: Make Gradle Wrapper Executable
run: chmod +x ./gradlew

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: gradle

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Gradle Build
run: ./gradlew build -Pbuild.release=true

- name: Capture Build Artifacts
uses: actions/upload-artifact@v4
with:
name: visual-snowy-leaves-artifacts-${{ steps.ref.outputs.branch }}
path: build/libs/*.jar
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
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) 2024-present StartsMercury

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.
85 changes: 85 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
object Constants {
const val VERSION = "0.1.0"

const val VERSION_JAVA = 17
const val VERSION_MINECRAFT = "1.20.1"
}

plugins {
id("fabric-loom") version "1.8.6"
}

base {
group = "io.github.startsmercury.visual_snowy_leaves"
archivesName = "visual-snowy-leaves"
version = createVersionString()
}

java {
withSourcesJar()

toolchain {
languageVersion = JavaLanguageVersion.of(Constants.VERSION_JAVA)
}
}

loom {
runtimeOnlyLog4j = true
splitEnvironmentSourceSets()

mods.register("visual-snowy-leaves") {
sourceSet("main")
sourceSet("client")
}
}

dependencies {
minecraft("com.mojang:minecraft:${Constants.VERSION_MINECRAFT}")
mappings(loom.officialMojangMappings())
modImplementation("net.fabricmc:fabric-loader:0.16.5")
}

tasks.withType<ProcessResources> {
val data = mapOf(
"version" to Constants.VERSION,
"version_java" to Constants.VERSION_JAVA,
"version_minecraft" to Constants.VERSION_MINECRAFT,
)

inputs.properties(data)

filesMatching("fabric.mod.json") {
expand(data)
}
}

tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release = Constants.VERSION_JAVA
}

fun createVersionString(): String {
val builder = StringBuilder()

val isReleaseBuild = project.hasProperty("build.release")
val buildId = System.getenv("GITHUB_RUN_NUMBER")

if (isReleaseBuild) {
builder.append(Constants.VERSION)
} else {
builder.append(Constants.VERSION.substringBefore('-'))
builder.append("-snapshot")
}

builder.append("+mc").append(Constants.VERSION_MINECRAFT)

if (!isReleaseBuild) {
if (buildId != null) {
builder.append("-build.${buildId}")
} else {
builder.append("-local")
}
}

return builder.toString()
}
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Template: Done to increase the memory available to gradle.
org.gradle.jvmargs = -Xmx1G
org.gradle.parallel = true
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.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 154cf58

Please sign in to comment.