Skip to content
This repository has been archived by the owner on Apr 21, 2024. It is now read-only.

Commit

Permalink
release: 1.0.0-alpha.1 (Merge pull request #5 from erha134/main)
Browse files Browse the repository at this point in the history
chore(Workflows): 更新 Workflows
  • Loading branch information
erha134 authored Mar 31, 2024
2 parents 92c9f33 + 29fcf54 commit 197e2fd
Show file tree
Hide file tree
Showing 48 changed files with 819 additions and 164 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: PR Check

on:
pull_request:

jobs:
test:
permissions:
contents: write
discussions: write

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- name: Setup jdk 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'

- uses: gradle/wrapper-validation-action@v2

- name: Fix Gradle permission
run: chmod +x gradlew

- name: Test with Gradle
run: ./gradlew buildArtifacts test --stacktrace --no-daemon
Empty file removed .github/workflows/ci.yml
Empty file.
64 changes: 64 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Push Build

on:
push:
workflow_dispatch:

jobs:
build:
if: ${{ !startsWith(github.ref.name, 'refs/tags/') && contains(github.event.head_commit.message, '[build skip]') == false }}
permissions:
contents: write

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- name: Setup jdk 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'

- uses: gradle/wrapper-validation-action@v2

- name: Fix Gradle permission
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew buildArtifacts --stacktrace --no-daemon

- name: Get short SHA
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV

- name: Read Properties info
id: prop_info
uses: christian-draeger/[email protected]
with:
path: gradle.properties
properties: "release_version"

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: TubeNekoPlugin-${{ env.SHORT_SHA }}
path: |
build/libs/*.jar
- name: Create GitHub Release
if: ${{ contains(github.event.head_commit.message, '[publish skip]') == false && contains(github.event.head_commit.message, 'release:') }}
uses: softprops/action-gh-release@v2
with:
files: |
build/libs/*.jar
!build/libs/*-dev.jar
!build/libs/*-dev-source.jar
name: ${{ steps.prop_info.outputs.release_version }}
tag_name: ${{ steps.prop_info.outputs.release_version }}-${{ env.SHORT_SHA }}
make_latest: "true"
target_commitish: ${{ github.event.ref }}
generate_release_notes: true
token: ${{ secrets.RELEASE_TOKEN }}
39 changes: 23 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ plugins {
allprojects {
apply plugin: "java"

group = 'xyz.tcbuildmc.minecraft'
version = '1.0.0-SNAPSHOT'
base.archivesName = "HorizontalNekoPlugin-" + project.name
group = rootProject.maven_group
version = rootProject.release_version
base.archivesName = "${rootProject.archives_base_name}-${project.name}"

repositories {
mavenLocal()
Expand Down Expand Up @@ -63,10 +63,14 @@ allprojects {
compileJava.dependsOn(clean)

jar {
archiveClassifier.set "dev"

zip64 true
}

sourcesJar {
archiveClassifier.set "dev-source"

duplicatesStrategy DuplicatesStrategy.EXCLUDE
}
}
Expand All @@ -81,20 +85,24 @@ subprojects {
annotationProcessor 'org.projectlombok:lombok:1.18.32'
compileOnly 'org.projectlombok:lombok:1.18.32'

implementation "com.electronwill.night-config:toml:3.6.7"
annotationProcessor(testImplementation("org.projectlombok:lombok:1.18.30"))
testImplementation platform('org.junit:junit-bom:5.10.2')
testImplementation 'org.junit.jupiter:junit-jupiter'
}

shadowJar {
dependencies {
include dependency("com.electronwill.night-config:core:3.6.7")
include dependency("com.electronwill.night-config:toml:3.6.7")
}
test {
useJUnitPlatform()

def reloc = { String from, String dest ->
relocate from, dest
ignoreFailures true

testLogging {
exceptionFormat = 'full'
events "passed", "skipped", "failed"
}
}

reloc "com.electronwill.nightconfig", "xyz.tcbuildmc.minecraft.hnp.nightconfig"
shadowJar {
archiveClassifier.set null

zip64 true
}
Expand All @@ -114,20 +122,19 @@ subprojects {
}

tasks.register("buildArtifacts") {
logger.lifecycle(":step1 build subprojects")

subprojects {
dependsOn project.tasks.named("build").get()
dependsOn project.tasks.named("shadowJar").get()
}

doFirst {
logger.lifecycle(":step2 clean buildLibs of rootProject")
logger.lifecycle(":executing 2 steps to build artifacts")
logger.lifecycle(":step1 clean buildLibs of rootProject")
delete fileTree(rootProject.buildDir.toPath().resolve("libs")) {
include '*'
}

logger.lifecycle(":step3 copy buildLibs from subprojects")
logger.lifecycle(":step2 copy buildLibs from subprojects")
subprojects {
copy {
from(project.buildDir.toPath().resolve("libs")) {
Expand Down
5 changes: 4 additions & 1 deletion bukkit/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
dependencies {
implementation project(path: ":common", configuration: "shadow")

compileOnly "org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT"
compileOnly "me.clip:placeholderapi:2.11.5"
implementation "dev.jorel:commandapi-bukkit-shade:9.3.0"
Expand All @@ -15,14 +17,15 @@ processResources {

shadowJar {
dependencies {
include project(":common")
include dependency("dev.jorel:commandapi-bukkit-shade:9.3.0")
}

def reloc = { String from, String dest ->
relocate from, dest
}

reloc "dev.jorel.commandapi", "xyz.tcbuildmc.minecraft.hnp.commandapi"
reloc "dev.jorel.commandapi", "xyz.tcbuildmc.minecraft.hnp.bukkit.commandapi"

zip64 true
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package xyz.tcbuildmc.minecraft.hnp.bukkit;

import dev.jorel.commandapi.CommandAPI;
import dev.jorel.commandapi.CommandAPIBukkitConfig;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;
import xyz.tcbuildmc.minecraft.hnp.bukkit.command.HorizontalNekoCommands;
import xyz.tcbuildmc.minecraft.hnp.common.HorizontalNekoPluginConfigHelper;

@Getter
public final class HorizontalNekoPlugin extends JavaPlugin {
private static HorizontalNekoPlugin instance;
private static HorizontalNekoPluginConfigHelper config;

public HorizontalNekoPlugin() {
HorizontalNekoPlugin.instance = this;
HorizontalNekoPlugin.config = new HorizontalNekoPluginConfigHelper(HorizontalNekoPlugin.class);
}

@Override
public void onLoad() {
// CommandAPI Initialize
CommandAPI.onLoad(new CommandAPIBukkitConfig(this).verboseOutput(true));

HorizontalNekoCommands.register();
}

@Override
public void onEnable() {
CommandAPI.onEnable();

config.load();
}

@Override
public void onDisable() {
config.close();

CommandAPI.onDisable();
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package xyz.tcbuildmc.minecraft.hnp.command;
package xyz.tcbuildmc.minecraft.hnp.bukkit.command;

import org.bukkit.ChatColor;
import xyz.tcbuildmc.minecraft.hnp.util.CommandUtils;
import xyz.tcbuildmc.minecraft.hnp.util.TextUtils;
import xyz.tcbuildmc.minecraft.hnp.bukkit.util.BukkitHolderString;
import xyz.tcbuildmc.minecraft.hnp.bukkit.util.CommandUtils;

import java.util.Random;

Expand All @@ -12,7 +12,7 @@ public static void register() {
.executes((sender, args) -> {
Random random = new Random();

sender.sendMessage(TextUtils.formatted("Your lucky number is: %number%")
sender.sendMessage(new BukkitHolderString("Your lucky number is: %number%")
.appendColor(ChatColor.AQUA)
.replaceHolder("%number%", random.nextInt(100))
.toString());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package xyz.tcbuildmc.minecraft.hnp.bukkit.command;

public final class LuckyCommand {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package xyz.tcbuildmc.minecraft.hnp.bukkit.hook.papi;

public class PlaceholderAPIHook {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package xyz.tcbuildmc.minecraft.hnp.bukkit.util;

import org.bukkit.ChatColor;
import xyz.tcbuildmc.common.util.HolderString;

public class BukkitHolderString extends HolderString {
public BukkitHolderString(String string) {
super(string);
}

public BukkitHolderString() {
}

public BukkitHolderString appendColor(ChatColor color) {
this.setString(color + this.getString());
return this;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.tcbuildmc.minecraft.hnp.util;
package xyz.tcbuildmc.minecraft.hnp.bukkit.util;

import dev.jorel.commandapi.CommandAPICommand;
import dev.jorel.commandapi.CommandPermission;
Expand All @@ -10,7 +10,7 @@
import org.bukkit.command.ProxiedCommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import xyz.tcbuildmc.minecraft.hnp.annotations.Testing;
import xyz.tcbuildmc.common.annotations.Testing;

import java.util.List;
import java.util.function.Predicate;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package xyz.tcbuildmc.minecraft.hnp.util;
package xyz.tcbuildmc.minecraft.hnp.bukkit.util;

import dev.jorel.commandapi.executors.CommandArguments;
import xyz.tcbuildmc.minecraft.hnp.annotations.Testing;
import xyz.tcbuildmc.common.annotations.Testing;

@Testing
@FunctionalInterface
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 197e2fd

Please sign in to comment.