Skip to content

Commit

Permalink
internal development. (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
portlek authored Jul 29, 2024
1 parent fc812f2 commit 7d5a73b
Show file tree
Hide file tree
Showing 88 changed files with 4,142 additions and 189 deletions.
47 changes: 23 additions & 24 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
name-template: '$RESOLVED_VERSION'
tag-template: '$RESOLVED_VERSION'
---
name-template: "$RESOLVED_VERSION"
tag-template: "$RESOLVED_VERSION"
prerelease: true
template: |
# What's Changed
$CHANGES
categories:
- title: Breaking
label: breaking
- title: New
label: enhancement
- title: Bug Fixes
label: bug
- title: Maintenance
label: maintenance
- title: Documentation
label: documentation
- title: Dependency Updates
label: dependencies

- title: "Breaking"
label: "breaking"
- title: "New"
label: "enhancement"
- title: "Bug Fixes"
label: "bug"
- title: "Maintenance"
label: "maintenance"
- title: "Documentation"
label: "documentation"
- title: "Dependency Updates"
label: "dependencies"
version-resolver:
major:
labels:
- breaking
- "breaking"
minor:
labels:
- enhancement
- "enhancement"
patch:
labels:
- bug
- maintenance
- documentation
- dependencies
- security

- "bug"
- "maintenance"
- "documentation"
- "dependencies"
- "security"
exclude-labels:
- skip-changelog
- "skip-changelog"
58 changes: 27 additions & 31 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
name: Build

on:
---
name: "Build"
"on":
pull_request:
branches: [ master ]

branches:
- "master"
jobs:
build:
name: Build
runs-on: ubuntu-latest
name: "Build"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '11'

- uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/cache@v4
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradlew-
- run: |
chmod +x gradlew
./gradlew build
- uses: "actions/checkout@v4"
- uses: "actions/setup-java@v4"
with:
distribution: "adopt"
java-version: "11"
- uses: "actions/cache@v4"
with:
path: "~/.gradle/caches"
key: "${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle.kts') }}"
restore-keys: |
${{ runner.os }}-gradle-
- uses: "actions/cache@v4"
with:
path: "~/.gradle/wrapper"
key: "${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}"
restore-keys: |
${{ runner.os }}-gradlew-
- run: |
chmod +x gradlew
./gradlew build
24 changes: 12 additions & 12 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Update Changelog

on:
---
name: "Update Changelog"
"on":
push:
branches: [ master ]

branches:
- "master"
jobs:
changelog:
name: Update Changelog
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, 'skip-snapshot') }}
name: "Update Changelog"
runs-on: "ubuntu-latest"
if: "${{ !contains(github.event.head_commit.message, 'skip-snapshot') }}"
steps:
- uses: release-drafter/release-drafter@master
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: "release-drafter/release-drafter@master"
id: "release"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
57 changes: 27 additions & 30 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
name: Release
on:
---
name: "Release"
"on":
release:
types:
- released
- "released"
jobs:
build:
name: Release
runs-on: ubuntu-latest
name: "Release"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '11'

- uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/cache@v4
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradlew-
- run: |
[[ "${{ github.event.release.tag_name }}" =~ ^[0-9]+(\.[0-9]+)*$ ]] || exit -1
chmod +x gradlew
./gradlew -Psign-required=true publish -Pversion="${{ github.event.release.tag_name }}" -PmavenCentralUsername="${{ secrets.MAVEN_CENTRAL_USERNAME }}" -PmavenCentralPassword="${{ secrets.MAVEN_CENTRAL_PASSWORD }}" -PsigningInMemoryKey="${{ secrets.GPG_PRIVATE_KEY_ARMORED }}" -PsigningInMemoryKeyPassword="${{ secrets.GPG_PASSPHRASE }}"
- uses: "actions/checkout@v4"
- uses: "actions/setup-java@v4"
with:
distribution: "adopt"
java-version: "11"
- uses: "actions/cache@v4"
with:
path: "~/.gradle/caches"
key: "${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle.kts') }}"
restore-keys: |
${{ runner.os }}-gradle-
- uses: "actions/cache@v4"
with:
path: "~/.gradle/wrapper"
key: "${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}"
restore-keys: |
${{ runner.os }}-gradlew-
- run: |
[[ "${{ github.event.release.tag_name }}" =~ ^[0-9]+(\.[0-9]+)*$ ]] || exit -1
chmod +x gradlew
./gradlew -Psign-required=true publish -Pversion="${{ github.event.release.tag_name }}" -PmavenCentralUsername="${{ secrets.MAVEN_CENTRAL_USERNAME }}" -PmavenCentralPassword="${{ secrets.MAVEN_CENTRAL_PASSWORD }}" -PsigningInMemoryKey="${{ secrets.GPG_PRIVATE_KEY_ARMORED }}" -PsigningInMemoryKeyPassword="${{ secrets.GPG_PASSPHRASE }}"
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,25 @@ repositories {
dependencies {
// Base module
implementation "net.infumia:pack:VERSION"
// Required, https://mvnrepository.com/artifact/net.kyori/adventure-api/
implementation "net.kyori:adventure-api:4.17.0"
// Required, https://mvnrepository.com/artifact/team.unnamed/creative-api/
implementation "team.unnamed:creative-api:1.7.2"
// Blank Slot (Optional)
implementation "net.infumia:pack-blank:VERSION"
// Language (Optional)
implementation "net.infumia:pack-language:VERSION"
// Generator (Optional)
implementation "net.infumia:pack-generator:VERSION"
// Required, https://mvnrepository.com/artifact/team.unnamed/team.unnamed:creative-serializer-minecraft/
implementation "team.unnamed:team.unnamed:creative-serializer-minecraft:1.7.2"
// Required, https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind/
implementation "com.fasterxml.jackson.core:jackson-databind:"
// Required, https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:"
}
```
### Code
Expand Down
9 changes: 9 additions & 0 deletions blank/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import net.infumia.gradle.publish

publish("blank")

dependencies {
compileOnly(project(":common"))

compileOnly(libs.creative.api)
}
63 changes: 63 additions & 0 deletions blank/src/main/java/net/infumia/pack/BlankSlot.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package net.infumia.pack;

import net.kyori.adventure.key.Key;
import net.kyori.adventure.key.KeyPattern;
import team.unnamed.creative.base.Writable;

/**
* Utility class for creating and retrieving blank slot file resources.
*/
public final class BlankSlot {

/**
* Retrieves a pre-configured blank slot file resource.
*
* @return A {@link FileResource} representing the blank slot.
*/
public static FileResource get() {
return Internal0.BLANK_SLOT.get();
}

/**
* Creates a blank slot file resource with the specified parameters.
*
* @param namespace The namespace for the model. Cannot be null.
* @param itemId The id for the item. Cannot be null.
* @param baseKey The key for the base model. Cannot be null.
* @param blankSlotImage The writable image for the blank slot. Cannot be null.
* @param customModelData The custom model data value.
* @return A {@link FileResource} representing the created blank slot.
*/
public static FileResource create(
@KeyPattern.Namespace final String namespace,
@KeyPattern.Value final String itemId,
final Key baseKey,
final Writable blankSlotImage,
final int customModelData
) {
return ResourceProducers.item(
Key.key(namespace, itemId),
baseKey,
blankSlotImage,
customModelData
);
}

private BlankSlot() {
throw new IllegalStateException("Utility class");
}

private static final class Internal0 {

private static final Lazy<FileResource> BLANK_SLOT = Lazy.of(
() ->
BlankSlot.create(
Internal.DEFAULT_NAMESPACE,
"blank_slot",
Key.key("item/paper"),
Internal.resourceFromJar("blank_slot.png"),
1
)
);
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 4 additions & 70 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,73 +1,7 @@
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.MavenPublishPlugin
import com.vanniktech.maven.publish.SonatypeHost
import net.infumia.gradle.spotless

plugins {
java
alias(libs.plugins.nexus) apply false
}
plugins { java }

repositories.mavenCentral()
subprojects { apply<JavaPlugin>() }

subprojects {
apply<JavaPlugin>()
apply<MavenPublishPlugin>()

repositories.mavenCentral()

java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}

tasks {
val javadocJar by creating(Jar::class) {
dependsOn("javadoc")
archiveClassifier.set("javadoc")
from(javadoc)
}

val sourcesJar by creating(Jar::class) {
dependsOn("classes")
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
}

val moduleName = project.findProperty("artifact-id") as String?
val projectName = "pack${if (moduleName == null) "" else "-$moduleName"}"
val signRequired = project.hasProperty("sign-required")

extensions.configure<MavenPublishBaseExtension> {
coordinates(project.group.toString(), projectName, project.version.toString())
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, true)
if (signRequired) {
signAllPublications()
}

pom {
name.set(projectName)
description.set("Minecraft resource pack generator.")
url.set("https://github.com/Infumia/pack")
licenses {
license {
name.set("MIT License")
url.set("https://mit-license.org/license.txt")
}
}
developers {
developer {
id.set("portlek")
name.set("Hasan Demirtaş")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/infumia/pack.git")
developerConnection.set("scm:git:ssh://github.com/infumia/pack.git")
url.set("https://github.com/infumia/pack/")
}
}
}
}
spotless()
Loading

0 comments on commit 7d5a73b

Please sign in to comment.