-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5ff405e
commit d7a0f04
Showing
8 changed files
with
118 additions
and
126 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Publish | ||
on: [ push ] | ||
concurrency: ci-${{ github.ref }} | ||
jobs: | ||
publish: | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.head_commit.message, '[CI-SKIP]')" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: temurin | ||
java-version: 17 | ||
cache: gradle | ||
- name: Generate build number | ||
id: buildnumber | ||
uses: onyxmueller/[email protected] | ||
with: | ||
token: ${{ secrets.github_token }} | ||
prefix: ${{ github.ref_name }} | ||
- name: Publish | ||
uses: uTen2c/[email protected] | ||
with: | ||
repo: ${{ secrets.REPO }} | ||
token-user: ${{ secrets.TOKEN_USER }} | ||
token: ${{ secrets.TOKEN }} | ||
publish-task: publish -Peula=true |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
DataGenerator/src/main/java/net/minestom/generators/SoundTypeGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package net.minestom.generators; | ||
|
||
import com.google.gson.JsonElement; | ||
import com.google.gson.JsonObject; | ||
import net.minecraft.world.level.block.SoundType; | ||
import net.minestom.datagen.DataGenerator; | ||
|
||
import java.util.Arrays; | ||
|
||
public class SoundTypeGenerator extends DataGenerator { | ||
@Override | ||
public JsonElement generate() throws Exception { | ||
final var jsonObject = new JsonObject(); | ||
Arrays.stream(SoundType.class.getDeclaredFields()) | ||
.filter(field -> { | ||
try { | ||
return field.get(null) instanceof SoundType; | ||
} catch (Throwable e) { | ||
return false; | ||
} | ||
}) | ||
.forEach(field -> { | ||
try { | ||
final var name = field.getName(); | ||
final var soundType = (SoundType) field.get(null); | ||
final var obj = new JsonObject(); | ||
obj.addProperty("volume", soundType.volume); | ||
obj.addProperty("pitch", soundType.pitch); | ||
obj.addProperty("breakSound", soundType.getBreakSound().getLocation().toString()); | ||
obj.addProperty("stepSound", soundType.getStepSound().getLocation().toString()); | ||
obj.addProperty("placeSound", soundType.getPlaceSound().getLocation().toString()); | ||
obj.addProperty("hitSound", soundType.getHitSound().getLocation().toString()); | ||
obj.addProperty("fallSound", soundType.getFallSound().getLocation().toString()); | ||
jsonObject.add(name, obj); | ||
} catch (IllegalAccessException e) { | ||
throw new RuntimeException(e); | ||
} | ||
}); | ||
return jsonObject; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,15 @@ plugins { | |
alias(libs.plugins.vanilla.gradle) apply false | ||
|
||
`maven-publish` | ||
signing | ||
alias(libs.plugins.nexuspublish) | ||
} | ||
|
||
group = "net.minestom" | ||
version = System.getenv("TAG_VERSION") ?: "${libs.versions.minecraft.get()}-dev" | ||
val publishPath = System.getenv()["PUBLISH_PATH"] | ||
val branch = System.getenv()["GITHUB_REF_NAME"] ?: "unknown" | ||
val buildNumber = System.getenv()["BUILD_NUMBER"] ?: "local-SNAPSHOT" | ||
val outputDirectory = (findProperty("output") ?: rootDir.resolve("MinestomData").absolutePath) as String | ||
|
||
group = "net.rainbootsmc" | ||
version = "$branch+build.$buildNumber" | ||
description = "Generator for Minecraft game data values" | ||
|
||
java { | ||
|
@@ -38,8 +41,8 @@ tasks.register("generateData") { | |
val eulaTxt = File("${rootProject.projectDir}/eula.txt") | ||
logger.warn("The file must be located at '${eulaTxt.absolutePath}'.") | ||
if ((eulaTxt.exists() && eulaTxt.readText(Charsets.UTF_8).equals("eula=true", true)) | ||
|| project.properties["eula"].toString().toBoolean() | ||
|| System.getenv("EULA")?.toBoolean() == true | ||
|| project.properties["eula"].toString().toBoolean() | ||
|| System.getenv("EULA")?.toBoolean() == true | ||
) { | ||
logger.warn("") | ||
logger.warn("The EULA has been accepted and signed.") | ||
|
@@ -59,77 +62,32 @@ tasks.register("generateData") { | |
}) | ||
} | ||
|
||
tasks.processResources.get().dependsOn("generateData") | ||
|
||
nexusPublishing { | ||
this.packageGroup.set("net.minestom") | ||
tasks.register<Jar>("dataJar") { | ||
dependsOn("generateData") | ||
|
||
repositories.sonatype { | ||
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) | ||
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) | ||
|
||
if (System.getenv("SONATYPE_USERNAME") != null) { | ||
username.set(System.getenv("SONATYPE_USERNAME")) | ||
password.set(System.getenv("SONATYPE_PASSWORD")) | ||
} | ||
} | ||
archiveBaseName.set("rainstom-data") | ||
archiveVersion.set(libs.versions.minecraft) | ||
destinationDirectory.set(layout.buildDirectory.dir("dist")) | ||
from(outputDirectory) | ||
} | ||
|
||
publishing.publications.create<MavenPublication>("maven") { | ||
groupId = "net.minestom" | ||
artifactId = "data" | ||
version = project.version.toString() | ||
|
||
from(project.components["java"]) | ||
tasks.processResources.get().dependsOn("generateData") | ||
|
||
pom { | ||
name.set("data") | ||
description.set("Minecraft game data values") | ||
url.set("https://github.com/minestom/MinestomDataGenerator") | ||
publishing { | ||
publications { | ||
create<MavenPublication>("maven") { | ||
groupId = "net.rainbootsmc" | ||
artifactId = "rainstom-data" | ||
version = project.version.toString() | ||
|
||
licenses { | ||
license { | ||
name.set("Apache 2.0") | ||
url.set("https://github.com/minestom/MinestomDataGenerator/blob/main/LICENSE") | ||
} | ||
artifact(tasks.getByName("dataJar")) | ||
} | ||
|
||
developers { | ||
developer { | ||
id.set("mworzala") | ||
name.set("Matt Worzala") | ||
email.set("[email protected]") | ||
} | ||
developer { | ||
id.set("TheMode") | ||
} | ||
if (publishPath != null) { | ||
repositories { | ||
maven { | ||
url = uri(publishPath) | ||
} | ||
} | ||
|
||
issueManagement { | ||
system.set("GitHub") | ||
url.set("https://github.com/minestom/MinestomDataGenerator/issues") | ||
} | ||
|
||
scm { | ||
connection.set("scm:git:git://github.com/minestom/MinestomDataGenerator.git") | ||
developerConnection.set("scm:git:[email protected]:minestom/MinestomDataGenerator.git") | ||
url.set("https://github.com/minestom/MinestomDataGenerator") | ||
tag.set("HEAD") | ||
} | ||
|
||
ciManagement { | ||
system.set("Github Actions") | ||
url.set("https://github.com/minestom/MinestomDataGenerator/actions") | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
isRequired = System.getenv("CI") != null | ||
|
||
val privateKey = System.getenv("GPG_PRIVATE_KEY") | ||
val keyPassphrase = System.getenv()["GPG_PASSPHRASE"] | ||
useInMemoryPgpKeys(privateKey, keyPassphrase) | ||
|
||
sign(publishing.publications) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters