Skip to content

Commit

Permalink
Merge pull request #38 from OneLiteFeatherNET/develop
Browse files Browse the repository at this point in the history
v1.0.0
  • Loading branch information
TheMeinerLP authored Jan 30, 2024
2 parents 6f51ea8 + 7797fa8 commit 4f642cb
Show file tree
Hide file tree
Showing 19 changed files with 681 additions and 133 deletions.
38 changes: 5 additions & 33 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@ on:
push:
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize
- labeled
- develop
jobs:
build:
# Run on all label events (won't be duplicated) or all push events or on PR syncs not from the same repo
Expand All @@ -27,41 +22,18 @@ jobs:
java-version: 17
- name: Clean Build
run: ./gradlew clean build shadowJar --no-daemon
- name: Determine release status
if: ${{ runner.os == 'Linux' }}
run: |
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
echo "STATUS=snapshot" >> $GITHUB_ENV
else
echo "STATUS=release" >> $GITHUB_ENV
fi
- name: Archive Artifacts
uses: actions/upload-artifact@v4
with:
name: AntiRedstoneClock-Remastered Archive
path: build/libs/AntiRedstoneClock-Remastered-*.jar
- name: Publish to hangar
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
run: ./gradlew publishAllPublicationsToHangar --no-daemon
env:
HANGAR_SECRET: ${{secrets.HANGAR_KEY}}
HANGAR_CHANNEL: "Release"
- name: Publish to hangar snapshot
if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
if: ${{ runner.os == 'Linux'}}
run: ./gradlew publishAllPublicationsToHangar --no-daemon
env:
HANGAR_SECRET: ${{secrets.HANGAR_KEY}}
HANGAR_CHANNEL: "Snapshot"
- name: Publish to Hangar
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
run: ./gradlew publishAllPublicationsToHangar --no-daemon
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_KEY }}
MODRINTH_CHANNEL: "release"
SHA_SHORT: ${{steps.vars.outputs.sha_short}}
- name: Publish to Modrinth Snapshot
if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
- name: Publish to Modrinth
if: ${{ runner.os == 'Linux' }}
run: ./gradlew modrinth --no-daemon
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_KEY }}
MODRINTH_CHANNEL: "beta"
MODRINTH_TOKEN: ${{ secrets.MODRINTH_KEY }}
2 changes: 2 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on:
push:
branches:
- master
- main
- develop
pull_request:
types: [opened, reopened, synchronize]
pull_request_target:
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ We re-created the whole code and improved everything. On top, we support Plotsqu
- Config Migration(Soon)
- Prevent duplicated loading of anti-redstoneclock plugins

> [!CAUTION]
> The "world" world is ignored by default
## Dependencies (soft-depend, can be used together)
- Plotsquared v7 https://github.com/IntellectualSites/PlotSquared
- Worldguard v7 https://github.com/EngineHub/WorldGuard
Expand All @@ -22,10 +25,14 @@ We re-created the whole code and improved everything. On top, we support Plotsqu
```
antiredstoneclockremastered.notify.admin
```
> [!CAUTION]
> All others can be taken from the Plugin.yml or use LuckPerms, which are automatically suggested there
## Commmands
- /arcm reload
- Reloads the config
- /arcm help
- Shows all commands and descriptions
- /arcm display
- Shows current cached redstone clocks

Expand Down
149 changes: 75 additions & 74 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import io.papermc.hangarpublishplugin.model.Platforms
import org.ajoberstar.grgit.Grgit
import xyz.jpenilla.runpaper.task.RunServer
import java.util.*

plugins {
id("java")
id("com.github.johnrengelman.shadow") version "8.1.1"
id("xyz.jpenilla.run-paper") version "2.2.2"
id("net.minecrell.plugin-yml.bukkit") version "0.6.0"
id("io.papermc.hangar-publish-plugin") version "0.1.1"
id("com.modrinth.minotaur") version "2.+"
id("org.jetbrains.changelog") version "2.2.0"
id("org.ajoberstar.grgit") version "5.2.1"
alias(libs.plugins.shadowJar)
alias(libs.plugins.publishdata)
alias(libs.plugins.paper.run)
alias(libs.plugins.bukkit.yml)
alias(libs.plugins.hangar)
alias(libs.plugins.modrinth)
}

if (!File("$rootDir/.git").exists()) {
logger.lifecycle(
"""
"""
**************************************************************************************
You need to fork and clone this repository! Don't download a .zip file.
If you need assistance, consult the GitHub docs: https://docs.github.com/get-started/quickstart/fork-a-repo
Expand All @@ -26,35 +23,24 @@ if (!File("$rootDir/.git").exists()) {
}

group = "net.onelitefeather"
var baseVersion by extra("1.0.0")
var extension by extra("")
var snapshot by extra("-SNAPSHOT")
ext {
val git: Grgit = Grgit.open {
dir = File("$rootDir/.git")
}
val revision = git.head().abbreviatedId
extension = "%s+%s".format(Locale.ROOT, snapshot, revision)
}

version = "%s%s".format(Locale.ROOT, baseVersion, extension)

val minecraftVersion = "1.20.1"
version = "1.0.0"
val supportedMinecraftVersions = listOf(
"1.16.5",
"1.17",
"1.17.1",
"1.18",
"1.18.1",
"1.18.2",
"1.19",
"1.19.1",
"1.19.2",
"1.19.3",
"1.19.4",
"1.20",
"1.20.1",
"1.20.2",
"1.16.5",
"1.17",
"1.17.1",
"1.18",
"1.18.1",
"1.18.2",
"1.19",
"1.19.1",
"1.19.2",
"1.19.3",
"1.19.4",
"1.20",
"1.20.1",
"1.20.2",
"1.20.3",
"1.20.4"
)

repositories {
Expand All @@ -63,31 +49,32 @@ repositories {
}

dependencies {
compileOnly("io.papermc.paper:paper-api:$minecraftVersion-R0.1-SNAPSHOT")
implementation("org.bstats:bstats-bukkit:3.0.2")
compileOnly(libs.paper)
implementation(libs.bstats)
implementation(libs.cloud.command.paper)
implementation(libs.cloud.command.extras)
implementation(libs.cloud.command.annotations)
annotationProcessor(libs.cloud.command.annotations)

implementation(project(":internal-api"))
implementation(project(":WorldGuardv6Support"))
implementation(project(":WorldGuardv7Support"))
implementation(project(":PlotSquaredv4Support"))
implementation(project(":PlotSquaredv6Support"))
implementation(project(":PlotSquaredv7Support"))
testImplementation(platform("org.junit:junit-bom:5.10.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
}

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}

tasks {

test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
publishData {
addMainRepo("")
addSnapshotRepo("")
publishTask("shadowJar")
}

tasks {
supportedMinecraftVersions.forEach { serverVersion ->
register<RunServer>("run-$serverVersion") {
minecraftVersion(serverVersion)
Expand All @@ -110,27 +97,37 @@ bukkit {
softDepend = listOf("PlotSquared", "WorldGuard")
permissions {
register("antiredstoneclockremastered.notify.admin")
register("antiredstoneclockremastered.command.reload")
register("antiredstoneclockremastered.command.help")
register("antiredstoneclockremastered.command.feature.check.observer")
register("antiredstoneclockremastered.command.feature.check.piston")
register("antiredstoneclockremastered.command.feature.check.sculk")
register("antiredstoneclockremastered.command.feature.check.redstone_and_repeater")
register("antiredstoneclockremastered.command.feature.check.world.add")
register("antiredstoneclockremastered.command.feature.check.world.remove")
register("antiredstoneclockremastered.command.feature.check.region.remove")
register("antiredstoneclockremastered.command.feature.check.region.add")
register("antiredstoneclockremastered.command.feature.clock.notifyAdmins")
register("antiredstoneclockremastered.command.feature.clock.notifyConsole")
register("antiredstoneclockremastered.command.feature.clock.drop")
register("antiredstoneclockremastered.command.feature.clock.enddelay")
register("antiredstoneclockremastered.command.feature.clock.maxCount")
}
}

changelog {
version.set(baseVersion)
path.set("${project.projectDir}/CHANGELOG.md")
itemPrefix.set("-")
keepUnreleasedSection.set(true)
unreleasedTerm.set("[Unreleased]")
groups.set(listOf("Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"))
}

hangarPublish {
publications.register("AntiRedstoneClock-Remastered") {
version.set(project.version.toString())
channel.set(System.getenv("HANGAR_CHANNEL"))
changelog.set(
project.changelog.renderItem(
project.changelog.getOrNull(baseVersion) ?: project.changelog.getUnreleased()
)
)
if (publishData.getVersion().contains("SNAPSHOT")) {
version.set(publishData.getVersion(true))
} else {
version.set(publishData.getVersion())
}
if (publishData.getVersion().contains("SNAPSHOT")) {
channel.set("Snapshot")
} else {
channel.set("Release")
}

apiKey.set(System.getenv("HANGAR_SECRET"))
id.set("AntiRedstoneClock-Remastered")

Expand All @@ -144,16 +141,20 @@ hangarPublish {
}
modrinth {
token.set(System.getenv("MODRINTH_TOKEN"))
projectId.set("UWh9tyEa") //TODO: Change
versionNumber.set(version.toString())
versionType.set(System.getenv("MODRINTH_CHANNEL"))
projectId.set("UWh9tyEa")
if (publishData.getVersion().contains("SNAPSHOT")) {
versionNumber.set(publishData.getVersion(true))
} else {
versionNumber.set(publishData.getVersion())
}
if (publishData.getVersion().contains("SNAPSHOT")) {
versionType.set("beta")
} else {
versionType.set("release")
}

uploadFile.set(tasks.shadowJar as Any)
gameVersions.addAll(supportedMinecraftVersions)
loaders.add("paper")
loaders.add("bukkit")
changelog.set(
project.changelog.renderItem(
project.changelog.getOrNull(baseVersion) ?: project.changelog.getUnreleased()
)
)
}
37 changes: 37 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,40 @@ include("WorldGuardv7Support")
include("PlotSquaredv4Support")
include("PlotSquaredv6Support")
include("PlotSquaredv7Support")

pluginManagement {
repositories {
maven("https://eldonexus.de/repository/maven-public/")
gradlePluginPortal()
}
}


dependencyResolutionManagement {
versionCatalogs {
create("libs") {
version("publishdata", "1.4.0")
version("modrinth", "2.+")
version("hangar", "0.1.0")
version("bukkit.yml", "0.6.0")
version("paper.run", "2.2.0")
version("shadowJar", "8.1.1")
version("paper", "1.20.4-R0.1-SNAPSHOT")
version("bstats", "3.0.2")
version("cloudcommand", "2.0.0-beta.1")

library("paper", "io.papermc.paper", "paper-api").versionRef("paper")
library("bstats", "org.bstats", "bstats-bukkit").versionRef("bstats")
library("cloud.command.paper", "org.incendo", "cloud-paper").versionRef("cloudcommand")
library("cloud.command.annotations", "org.incendo", "cloud-annotations").versionRef("cloudcommand")
library("cloud.command.extras", "org.incendo", "cloud-minecraft-extras").versionRef("cloudcommand")

plugin("publishdata","de.chojo.publishdata").versionRef("publishdata")
plugin("modrinth", "com.modrinth.minotaur").versionRef("modrinth")
plugin("hangar", "io.papermc.hangar-publish-plugin").versionRef("hangar")
plugin("bukkit.yml", "net.minecrell.plugin-yml.bukkit").versionRef("bukkit.yml")
plugin("paper.run", "xyz.jpenilla.run-paper").versionRef("paper.run")
plugin("shadowJar", "com.github.johnrengelman.shadow").versionRef("shadowJar")
}
}
}
Loading

0 comments on commit 4f642cb

Please sign in to comment.