From 5f821dd56d7eea76b68fb18b8c1eaecd0a056755 Mon Sep 17 00:00:00 2001 From: TylerS1066 Date: Tue, 10 Sep 2024 21:28:04 -0500 Subject: [PATCH 1/3] Update build --- build.gradle.kts | 91 +++++++++++++++-------------- gradle/libs.versions.toml | 16 ------ pom.xml | 104 ---------------------------------- settings.gradle.kts | 4 -- src/main/resources/plugin.yml | 4 +- 5 files changed, 47 insertions(+), 172 deletions(-) delete mode 100644 gradle/libs.versions.toml delete mode 100644 pom.xml diff --git a/build.gradle.kts b/build.gradle.kts index 0186845..b14a1d4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,66 +1,65 @@ -/* - * This file was generated by the Gradle 'init' task. - */ - plugins { `java-library` `maven-publish` + id("io.github.0ffz.github-packages") version "1.2.1" } repositories { mavenLocal() - maven { - url = uri("https://maven.pkg.github.com/APDevTeam/Movecraft") - } - - maven { - url = uri("https://repo.maven.apache.org/maven2/") - } - - maven { - url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") - } - - maven { - url = uri("https://maven.enginehub.org/repo/") - } - - maven { - url = uri("https://repo.citizensnpcs.co/") - } - - maven { - url = uri("https://oss.sonatype.org/content/groups/public/") - } - - maven { - url = uri("https://jitpack.io") - } + mavenCentral() + maven("https://repo.papermc.io/repository/maven-public/") + maven { githubPackage("apdevteam/movecraft")(this) } + maven("https://maven.enginehub.org/repo/") + maven("https://repo.citizensnpcs.co/") + maven("https://jitpack.io") } dependencies { - api(libs.net.citizensnpcs.citizens.main) - compileOnly(libs.org.spigotmc.spigot.api) - compileOnly(libs.com.sk89q.worldguard.worldguard.bukkit) - compileOnly(libs.com.github.milkbowl.vaultapi) - system(libs.com.degitise.minevid.dtltraders) + api("org.jetbrains:annotations-java5:24.1.0") + compileOnly("io.papermc.paper:paper-api:1.20.6-R0.1-SNAPSHOT") + compileOnly("net.countercraft:movecraft:+") + compileOnly("net.citizensnpcs:citizensapi:+") + compileOnly(files("libs/dtlTraders.jar")) + compileOnly("com.github.MilkBowl:VaultAPI:1.7.1") + api("com.sk89q.worldguard:worldguard-bukkit:7.0.10") } group = "net.apdevteam.apautonpc" -version = "4.0.0_beta-2" +version = "4.0.0_beta-2_gradle" description = "APAutoNPC" -java.sourceCompatibility = JavaVersion.VERSION_13 +java.toolchain.languageVersion = JavaLanguageVersion.of(21) -publishing { - publications.create("maven") { - from(components["java"]) - } +tasks.jar { + archiveBaseName.set("APAutoNPC") + archiveClassifier.set("") + archiveVersion.set("") } -tasks.withType() { - options.encoding = "UTF-8" +tasks.processResources { + from(rootProject.file("LICENSE.md")) + filesMatching("*.yml") { + expand(mapOf("projectVersion" to project.version)) + } } -tasks.withType() { - options.encoding = "UTF-8" +publishing { + publications { + create("maven") { + groupId = "net.apdevteam.apautonpc" + artifactId = "apautonpc" + version = "${project.version}" + + artifact(tasks.jar) + } + } + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/apdevteam/apautonpc") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml deleted file mode 100644 index 4fe8c07..0000000 --- a/gradle/libs.versions.toml +++ /dev/null @@ -1,16 +0,0 @@ -# This file was generated by the Gradle 'init' task. -# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format - -[versions] -com-degitise-minevid-dtltraders = "LATEST" -com-github-milkbowl-vaultapi = "1.7.1" -com-sk89q-worldguard-worldguard-bukkit = "7.0.7" -net-citizensnpcs-citizens-main = "2.0.32-SNAPSHOT" -org-spigotmc-spigot-api = "1.14.4-R0.1-SNAPSHOT" - -[libraries] -com-degitise-minevid-dtltraders = { module = "com.degitise.minevid:dtlTraders", version.ref = "com-degitise-minevid-dtltraders" } -com-github-milkbowl-vaultapi = { module = "com.github.MilkBowl:VaultAPI", version.ref = "com-github-milkbowl-vaultapi" } -com-sk89q-worldguard-worldguard-bukkit = { module = "com.sk89q.worldguard:worldguard-bukkit", version.ref = "com-sk89q-worldguard-worldguard-bukkit" } -net-citizensnpcs-citizens-main = { module = "net.citizensnpcs:citizens-main", version.ref = "net-citizensnpcs-citizens-main" } -org-spigotmc-spigot-api = { module = "org.spigotmc:spigot-api", version.ref = "org-spigotmc-spigot-api" } diff --git a/pom.xml b/pom.xml deleted file mode 100644 index f150732..0000000 --- a/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - 4.0.0 - - net.apdevteam.apautonpc - APAutoNPC - 4.0.0_beta-2 - jar - - APAutoNPC - - - 13 - UTF-8 - - - - APAutoNPC - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - ${java.version} - ${java.version} - - - - - - src/main/resources - true - - - . - . - - LICENSE.md - - - - - - - - spigot-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - - - enginehub-repo - https://maven.enginehub.org/repo/ - - - citizens-repo - https://repo.citizensnpcs.co/ - - - sonatype - https://oss.sonatype.org/content/groups/public/ - - - jitpack.io - https://jitpack.io - - - - - - org.spigotmc - spigot-api - 1.14.4-R0.1-SNAPSHOT - provided - - - net.citizensnpcs - citizens-main - 2.0.32-SNAPSHOT - - - - com.degitise.minevid - dtlTraders - LATEST - system - ${project.basedir}/libs/dtlTraders.jar - - - - com.sk89q.worldguard - worldguard-bukkit - 7.0.7 - provided - - - com.github.MilkBowl - VaultAPI - 1.7.1 - provided - - - diff --git a/settings.gradle.kts b/settings.gradle.kts index c329844..e3d0f55 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1 @@ -/* - * This file was generated by the Gradle 'init' task. - */ - rootProject.name = "APAutoNPC" diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 164ad82..ba43fef 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: APAutoNPC -version: ${project.version} +version: ${projectVersion} main: net.apdevteam.apautonpc.APAutoNPC -api-version: 1.14 +api-version: 1.20 authors: [TylerS1066, _MrUniverse, APDevTeam] depend: [WorldGuard, WorldEdit, Vault, Citizens, dtlTraders] commands: From 7956408354d11c6ac6e1a3830f58cb72eb591c33 Mon Sep 17 00:00:00 2001 From: TylerS1066 Date: Tue, 10 Sep 2024 21:29:33 -0500 Subject: [PATCH 2/3] Update CI --- .github/workflows/gradle.yml | 58 ++++++++++++++++++++++++++++++++++++ .github/workflows/maven.yml | 30 ------------------- 2 files changed, 58 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/gradle.yml delete mode 100644 .github/workflows/maven.yml diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..69945cc --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,58 @@ +name: Gradle CI + +on: + workflow_dispatch: + push: + pull_request: + release: + types: [created, prereleased] + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + packages: write + + steps: + - name: Checkout APAutoNPC + uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + build-scan-publish: true + build-scan-terms-of-use-url: "https://gradle.com/terms-of-service" + build-scan-terms-of-use-agree: "yes" + + - name: Build with Gradle + run: ./gradlew clean build --parallel + + - name: Publish to GitHub Packages + if: ${{ github.event_name == 'release' }} + run: ./gradlew publish --parallel + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Stage jar for Actions + if: ${{ github.event_name != 'release' }} + run: mkdir staging && cp build/libs/APAutoNPC.jar staging && mv staging/APAutoNPC.jar staging/APAutoNPC_$GITHUB_SHA.jar + - name: Upload jar to Actions + if: ${{ github.event_name != 'release' }} + uses: actions/upload-artifact@v4 + with: + name: APAutoNPC_Dev-Build + path: staging/APAutoNPC_*.jar + + - name: Stage jar for Release + if: ${{ github.event_name == 'release' }} + run: mkdir staging && cp build/libs/APAutoNPC.jar staging && mv staging/APAutoNPC.jar staging/APAutoNPC_${{ github.event.release.tag_name }}.jar + - name: Upload jar to Release + if: ${{ github.event_name == 'release' }} + uses: softprops/action-gh-release@v2 + with: + files: staging/APAutoNPC_${{ github.event.release.tag_name }}.jar diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml deleted file mode 100644 index aa2327e..0000000 --- a/.github/workflows/maven.yml +++ /dev/null @@ -1,30 +0,0 @@ - -name: Java CI - -on: [workflow_dispatch, push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - - name: Set up JDK 17 - uses: actions/setup-java@v1 - with: - java-version: 17 - - name: Cache Maven packages - uses: actions/cache@v3 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2 - restore-keys: ${{ runner.os }}-m2 - - name: Build with Maven - run: mvn -B package --file pom.xml - - name: Stage jar - run: mkdir staging && cp target/APAutoNPC*.jar staging && mv staging/APAutoNPC*.jar staging/APAutoNPC_$GITHUB_SHA.jar - - name: Upload jar - uses: actions/upload-artifact@v3 - with: - name: APAutoNPC_Dev-Build - path: staging/APAutoNPC_*.jar From c90f0307335a49dc177325324a30e155606d7f0e Mon Sep 17 00:00:00 2001 From: TylerS1066 Date: Tue, 10 Sep 2024 21:29:39 -0500 Subject: [PATCH 3/3] Changing permission of gradlew --- gradlew | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 gradlew diff --git a/gradlew b/gradlew old mode 100644 new mode 100755