mirror of
https://github.com/ColdeZhang/Dominion.git
synced 2024-10-18 19:08:40 +08:00
精简项目结构,提供两种不同下载版本
This commit is contained in:
parent
897c6f17fd
commit
9eb69a4ecc
@ -21,9 +21,8 @@ jobs:
|
||||
cache: gradle
|
||||
- name: "Build with Gradle"
|
||||
run: |
|
||||
./gradlew buildPlugin
|
||||
- name: "Copy jar to staging"
|
||||
run: mkdir staging && cp build/libs/*.jar staging/
|
||||
chmod +x ./BuildScript.sh
|
||||
./BuildScript.sh all
|
||||
- name: "Build & test"
|
||||
run: |
|
||||
echo "done!"
|
||||
@ -36,7 +35,7 @@ jobs:
|
||||
- name: "Release"
|
||||
uses: https://ssl.lunadeer.cn:14446/zhangyuheng/release-action@main
|
||||
with:
|
||||
note: " - 带 `original-` 前缀的文件无法用于运行,请下载不带此前缀的版本。"
|
||||
note: " - `full` 后缀包含所有依赖直接安装即可使用,`lite` 后缀不包含任何依赖,会在第一次安装后启动时自动下载"
|
||||
files: |-
|
||||
staging/*.jar
|
||||
api_key: '${{secrets.RELEASE_TOKEN}}'
|
10
.github/workflows/main.yml
vendored
10
.github/workflows/main.yml
vendored
@ -19,10 +19,9 @@ jobs:
|
||||
distribution: 'zulu'
|
||||
cache: gradle
|
||||
- name: "Build with Gradle"
|
||||
run: ./gradlew buildPlugin
|
||||
- name: "Copy jar to staging"
|
||||
run: |
|
||||
mkdir staging && cp build/libs/*.jar staging/
|
||||
chmod +x ./BuildScript.sh
|
||||
./BuildScript.sh all
|
||||
- name: "Build & test"
|
||||
run: |
|
||||
TAG=$(echo $GITHUB_REF | sed 's/refs\/tags\///')
|
||||
@ -46,7 +45,7 @@ jobs:
|
||||
game_versions: 1.20.1:1.20.6,1.21,1.21.1
|
||||
version_number: ${{ env.AUTOMATIC_RELEASES_TAG }}
|
||||
files: |
|
||||
staging/*.jar
|
||||
staging/*-lite.jar
|
||||
changelog: "See https://github.com/ColdeZhang/Dominion/releases/tag/${{ env.AUTOMATIC_RELEASES_TAG }}"
|
||||
version_type: beta
|
||||
featured: false
|
||||
@ -55,5 +54,4 @@ jobs:
|
||||
- name: "Hangar Release"
|
||||
env:
|
||||
HANGAR_TOKEN: ${{ secrets.HANGAR_API_TOKEN }}
|
||||
run: ./gradlew build publishPluginPublicationToHangar --stacktrace
|
||||
continue-on-error: true
|
||||
run: ./gradlew build publishPluginPublicationToHangar -PBuildFull=false
|
||||
|
26
BuildScript.sh
Normal file
26
BuildScript.sh
Normal file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin bash
|
||||
|
||||
mode=full
|
||||
|
||||
if [ $# -eq 1 ]; then
|
||||
mode=$1
|
||||
fi
|
||||
|
||||
./gradlew clean
|
||||
|
||||
# all full lite
|
||||
if [ $mode == "all" ]; then
|
||||
./gradlew shadowJar -PBuildFull=false
|
||||
./gradlew shadowJar -PBuildFull=true
|
||||
elif [ $mode == "lite" ]; then
|
||||
./gradlew shadowJar -PBuildFull=false
|
||||
elif [ $mode == "full" ]; then
|
||||
./gradlew shadowJar -PBuildFull=true
|
||||
else
|
||||
echo "Invalid mode: $mode"
|
||||
echo "Usage: $0 [all|full|lite]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p staging
|
||||
mv build/libs/*.jar staging/
|
@ -6,8 +6,12 @@ plugins {
|
||||
id("io.papermc.hangar-publish-plugin") version "0.1.2"
|
||||
}
|
||||
|
||||
var BuildFull = properties["BuildFull"].toString() == "true"
|
||||
var libraries = listOf<String>()
|
||||
libraries = libraries + "cn.lunadeer:MinecraftPluginUtils:1.3.10"
|
||||
|
||||
group = "cn.lunadeer"
|
||||
version = "2.10.2-beta"
|
||||
version = "2.11.0-beta"
|
||||
|
||||
java {
|
||||
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
|
||||
@ -29,7 +33,6 @@ allprojects {
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
maven("https://jitpack.io")
|
||||
maven("https://repo.mikeprimm.com/")
|
||||
maven("https://ssl.lunadeer.cn:14454/repository/maven-snapshots/")
|
||||
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
|
||||
}
|
||||
|
||||
@ -38,8 +41,15 @@ allprojects {
|
||||
compileOnly("us.dynmap:DynmapCoreAPI:3.4")
|
||||
compileOnly("me.clip:placeholderapi:2.11.6")
|
||||
|
||||
implementation("cn.lunadeer:MinecraftPluginUtils:1.3.10-SNAPSHOT")
|
||||
implementation("org.yaml:snakeyaml:2.0")
|
||||
if (!BuildFull) {
|
||||
libraries.forEach {
|
||||
compileOnly(it)
|
||||
}
|
||||
} else {
|
||||
libraries.forEach {
|
||||
implementation(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
@ -53,6 +63,15 @@ allprojects {
|
||||
filter {
|
||||
it.replace("@version@", rootProject.version.toString())
|
||||
}
|
||||
if (!BuildFull) {
|
||||
var libs = "libraries: ["
|
||||
libraries.forEach {
|
||||
libs += "$it,"
|
||||
}
|
||||
filter {
|
||||
it.replace("libraries: []", libs.substring(0, libs.length - 1) + "]")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,6 +79,8 @@ allprojects {
|
||||
archiveClassifier.set("")
|
||||
archiveVersion.set(project.version.toString())
|
||||
dependsOn(tasks.withType<ProcessResources>())
|
||||
// add -lite to the end of the file name if BuildLite is true or -full if BuildLite is false
|
||||
archiveFileName.set("${project.name}-${project.version}${if (BuildFull) "-full" else "-lite"}.jar")
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,7 +95,7 @@ tasks.shadowJar {
|
||||
archiveVersion.set(project.version.toString())
|
||||
}
|
||||
|
||||
tasks.register("buildPlugin") { // <<<< RUN THIS TASK TO BUILD PLUGIN
|
||||
tasks.register("Clean&Build") { // <<<< RUN THIS TASK TO BUILD PLUGIN
|
||||
dependsOn(tasks.clean)
|
||||
dependsOn(tasks.shadowJar)
|
||||
}
|
||||
@ -98,5 +119,5 @@ hangarPublish {
|
||||
}
|
||||
|
||||
tasks.named("publishPluginPublicationToHangar") {
|
||||
dependsOn(tasks.named("jar"))
|
||||
dependsOn(tasks.named("Clean&Build"))
|
||||
}
|
@ -3,6 +3,7 @@ version: @version@
|
||||
main: cn.lunadeer.dominion.Dominion
|
||||
api-version: '1.20'
|
||||
folia-supported: true
|
||||
libraries: [ ]
|
||||
softdepend:
|
||||
- Vault
|
||||
- dynmap
|
||||
|
Loading…
Reference in New Issue
Block a user