From b6278bb61b9ef7a199585465474fa2784d1b31ce Mon Sep 17 00:00:00 2001 From: iambibi_ <89582596+iambibi@users.noreply.github.com> Date: Sun, 20 Apr 2025 23:14:40 +0200 Subject: [PATCH 01/15] Update build.gradle --- build.gradle | 76 ++++++++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/build.gradle b/build.gradle index e6d6d2838..264cf89e3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,20 +1,24 @@ plugins { - id 'java' - id "com.github.johnrengelman.shadow" version "8.1.1" + id("java") + id("com.github.johnrengelman.shadow") version "8.1.1" } -group = 'fr.openmc' -version = "GIT-"+System.getenv("GITHUB_SHA") ?: "unknown" +// Versioning +val pluginVersion = "2.0.0" +val gitHash = System.getenv("GITHUB_SHA") ?: "local" +version = "$pluginVersion-${gitHash.take(7)}" + +group = "fr.openmc" repositories { mavenCentral() - maven {url = "https://repo.papermc.io/repository/maven-public/"} - maven {url = "https://oss.sonatype.org/content/groups/public/"} - maven {url = "https://mvn.mathiasd.fr/releases"} - maven {url = "https://maven.enginehub.org/repo/" } - maven {url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'} - maven {url = "https://repo.dmulloy2.net/repository/public/"} - maven {url = "https://jitpack.io"} // Laissez en dernier + maven("https://repo.papermc.io/repository/maven-public/") + maven("https://oss.sonatype.org/content/groups/public/") + maven("https://mvn.mathiasd.fr/releases") + maven("https://maven.enginehub.org/repo/") + maven("https://repo.extendedclip.com/content/repositories/placeholderapi/") + maven("https://repo.dmulloy2.net/repository/public/") + maven("https://jitpack.io") // Toujours à la fin } dependencies { @@ -22,23 +26,21 @@ dependencies { compileOnly("com.github.LoneDev6:API-ItemsAdder:3.6.3-beta-14") compileOnly("net.luckperms:api:5.4") compileOnly("me.clip:placeholderapi:2.11.6") - compileOnly('com.sk89q.worldguard:worldguard-bukkit:7.0.9') - compileOnly("com.github.dmulloy2:ProtocolLib:-SNAPSHOT") // ProtocolLib + compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.9") + compileOnly("com.github.dmulloy2:ProtocolLib:-SNAPSHOT") implementation("de.rapha149.signgui:signgui:2.5.0") implementation("dev.xernas:menulib:1.1.0") implementation("org.jetbrains:annotations:24.1.0") implementation("com.github.Revxrsal.Lamp:common:3.2.1") implementation("com.github.Revxrsal.Lamp:bukkit:3.2.1") - implementation("net.raidstone:wgevents:1.18.1") // Version custom de Webbeh/WorldGuard-Events + implementation("net.raidstone:wgevents:1.18.1") - // lombok compileOnly("org.projectlombok:lombok:1.18.34") annotationProcessor("org.projectlombok:lombok:1.18.34") testCompileOnly("org.projectlombok:lombok:1.18.34") testAnnotationProcessor("org.projectlombok:lombok:1.18.34") - // unit tests testImplementation("org.slf4j:slf4j-simple:2.0.16") testImplementation("org.junit.jupiter:junit-jupiter:5.11.0") testRuntimeOnly("org.junit.platform:junit-platform-launcher") @@ -46,48 +48,52 @@ dependencies { testImplementation("com.h2database:h2:2.3.232") } -def targetJavaVersion = 21 +val targetJavaVersion = 21 java { - def javaVersion = JavaVersion.toVersion(targetJavaVersion) + val javaVersion = JavaVersion.toVersion(targetJavaVersion) sourceCompatibility = javaVersion targetCompatibility = javaVersion if (JavaVersion.current() < javaVersion) { - toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) + toolchain.languageVersion.set(JavaLanguageVersion.of(targetJavaVersion)) } } -tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' - - if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { +tasks.withType().configureEach { + options.encoding = "UTF-8" + if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible) { options.release.set(targetJavaVersion) } } processResources { - def props = [version: version] - inputs.properties props - filteringCharset 'UTF-8' - filesMatching('paper-plugin.yml') { - expand props + val props = mapOf("version" to version) + inputs.properties(props) + filteringCharset = "UTF-8" + filesMatching("paper-plugin.yml") { + expand(props) } } -jar { + +tasks.jar { manifest { - attributes("GIT-COMMIT" : System.getenv("GITHUB_SHA") ?: "unknown") + attributes["GIT-COMMIT"] = gitHash } destinationDirectory.set(file("./builds/")) } -clean { - delete "builds" +tasks.clean { + delete("builds") } -shadowJar { +tasks.shadowJar { destinationDirectory.set(file("./builds/")) - archiveFileName = "OpenMC.jar" + archiveFileName.set("OpenMC.jar") +} + +tasks.test { + useJUnitPlatform() } test { useJUnitPlatform() } -apply plugin: "com.github.johnrengelman.shadow" \ No newline at end of file +apply plugin: "com.github.johnrengelman.shadow" From 647ad3c7daf2768c801cb5c9310e03da30de3ced Mon Sep 17 00:00:00 2001 From: iambibi_ <89582596+iambibi@users.noreply.github.com> Date: Sun, 20 Apr 2025 23:15:23 +0200 Subject: [PATCH 02/15] Update plugin.yml --- src/main/resources/plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index f97493753..88896e9c7 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: OpenMC -version: '2.0.0' +version: ${version} main: fr.openmc.core.OMCPlugin api-version: '1.21.4' From c99d0da997b03884d79769c1163843516aef56d3 Mon Sep 17 00:00:00 2001 From: iambibi_ <89582596+iambibi@users.noreply.github.com> Date: Mon, 21 Apr 2025 09:43:36 +0200 Subject: [PATCH 03/15] Update build.gradle --- build.gradle | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index 264cf89e3..0fb8c5b2d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,13 @@ plugins { - id("java") + java id("com.github.johnrengelman.shadow") version "8.1.1" } // Versioning -val pluginVersion = "2.0.0" +val pluginVersion = System.getProperty("PLUGIN_VERSION") ?: "2.0.0" +val isSnapshot = System.getProperty("SNAPSHOT")?.toBoolean() ?: true val gitHash = System.getenv("GITHUB_SHA") ?: "local" -version = "$pluginVersion-${gitHash.take(7)}" +version = if (isSnapshot) "$pluginVersion-SNAPSHOT-${gitHash.take(7)}" else pluginVersion group = "fr.openmc" @@ -18,7 +19,7 @@ repositories { maven("https://maven.enginehub.org/repo/") maven("https://repo.extendedclip.com/content/repositories/placeholderapi/") maven("https://repo.dmulloy2.net/repository/public/") - maven("https://jitpack.io") // Toujours à la fin + maven("https://jitpack.io") } dependencies { @@ -86,14 +87,11 @@ tasks.clean { } tasks.shadowJar { + val fileName = "OpenMC-${project.version}.jar" destinationDirectory.set(file("./builds/")) - archiveFileName.set("OpenMC.jar") + archiveFileName.set(fileName) } tasks.test { useJUnitPlatform() } - -test { useJUnitPlatform() } - -apply plugin: "com.github.johnrengelman.shadow" From f8e9c54138029a1c755a781971b6c256fe4c0452 Mon Sep 17 00:00:00 2001 From: iambibi_ <89582596+iambibi@users.noreply.github.com> Date: Mon, 21 Apr 2025 09:44:20 +0200 Subject: [PATCH 04/15] Update main.yml --- .github/workflows/main.yml | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ea33a588c..fb4131917 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,19 +3,15 @@ name: Build DEV Jars on: pull_request: paths-ignore: - - '.github/PULL_REQUEST_TEMPLATE.md' + - '.github/**' - '.gitignore' - 'LICENSE' - - 'CODE_OF_CONDUCT.md' - - 'CONTRIBUTING.md' - 'README.md' push: paths-ignore: - - '.github/PULL_REQUEST_TEMPLATE.md' + - '.github/**' - '.gitignore' - 'LICENSE' - - 'CODE_OF_CONDUCT.md' - - 'CONTRIBUTING.md' - 'README.md' jobs: @@ -27,22 +23,23 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Setup JDK uses: actions/setup-java@v2 with: distribution: 'adopt' java-version: '21' + - name: Build with Gradle run: | - chmod 777 gradlew - ./gradlew shadowJar - git_hash=$(git rev-parse --short "$GITHUB_SHA") - echo "git_hash=$git_hash" >> $GITHUB_ENV - echo "snapshotVersion=5.5-SNAPSHOT" >> $GITHUB_ENV - echo "artifactPath=$(pwd)/builds" >> $GITHUB_ENV + chmod +x ./gradlew + ./gradlew shadowJar -DPLUGIN_VERSION=2.0.0 -DSNAPSHOT=true + env: + GITHUB_SHA: ${{ github.sha }} + - name: Upload Plugin jar - continue-on-error: true uses: actions/upload-artifact@v4 with: - name: OpenMC-${{ env.git_hash }}.jar - path: ${{ env.artifactPath }}/OpenMC.jar + name: OpenMC-${{ github.sha }} + path: builds/OpenMC-*.jar + From 0d34ad6ad78580fe683c38206b851e9fbe3e166b Mon Sep 17 00:00:00 2001 From: iambibi_ <89582596+iambibi@users.noreply.github.com> Date: Mon, 21 Apr 2025 09:44:54 +0200 Subject: [PATCH 05/15] Create release.yml --- .github/workflows/release.yml | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..316bdf9dc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +name: Release Stable Version + +on: + milestone: + types: [closed] + +jobs: + release_stable: + if: github.event.milestone.title =~ '^\d+\.\d+\.\d+$' + name: Release Stable Jar + runs-on: ubuntu-latest + permissions: write-all + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup JDK + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '21' + + - name: Build stable JAR + run: | + chmod +x ./gradlew + ./gradlew shadowJar -DPLUGIN_VERSION=${{ github.event.milestone.title }} -DSNAPSHOT=false + env: + GITHUB_SHA: ${{ github.sha }} + + - name: Rename Jar + run: | + mkdir -p release + mv builds/OpenMC-${{ github.event.milestone.title }}.jar release/OpenMC-${{ github.event.milestone.title }}.jar + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + with: + name: OpenMC ${{ github.event.milestone.title }} + tag_name: v${{ github.event.milestone.title }} + files: release/OpenMC-${{ github.event.milestone.title }}.jar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + From 46c78b9a426e405fba31c42c69580ab3eb7a7b48 Mon Sep 17 00:00:00 2001 From: iambibi_ <89582596+iambibi@users.noreply.github.com> Date: Mon, 21 Apr 2025 09:46:46 +0200 Subject: [PATCH 06/15] Update release.yml --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 316bdf9dc..bc97037f2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,6 @@ on: jobs: release_stable: - if: github.event.milestone.title =~ '^\d+\.\d+\.\d+$' name: Release Stable Jar runs-on: ubuntu-latest permissions: write-all From 862573361be38acb8e19a2e7a7384f99fb115e19 Mon Sep 17 00:00:00 2001 From: iambibi_ <89582596+iambibi@users.noreply.github.com> Date: Mon, 21 Apr 2025 09:48:55 +0200 Subject: [PATCH 07/15] Update build.gradle --- build.gradle | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 0fb8c5b2d..134af7788 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,20 @@ plugins { - java + id("java") id("com.github.johnrengelman.shadow") version "8.1.1" } // Versioning -val pluginVersion = System.getProperty("PLUGIN_VERSION") ?: "2.0.0" -val isSnapshot = System.getProperty("SNAPSHOT")?.toBoolean() ?: true +val pluginVersion = "2.0.0" val gitHash = System.getenv("GITHUB_SHA") ?: "local" -version = if (isSnapshot) "$pluginVersion-SNAPSHOT-${gitHash.take(7)}" else pluginVersion + +// Déclaration du snapshot conditionnel +val isSnapshot = System.getenv("SNAPSHOT")?.toBoolean() ?: false + +version = if (isSnapshot) { + "$pluginVersion-SNAPSHOT-${gitHash.take(7)}" +} else { + pluginVersion +} group = "fr.openmc" @@ -19,7 +26,7 @@ repositories { maven("https://maven.enginehub.org/repo/") maven("https://repo.extendedclip.com/content/repositories/placeholderapi/") maven("https://repo.dmulloy2.net/repository/public/") - maven("https://jitpack.io") + maven("https://jitpack.io") // Toujours à la fin } dependencies { @@ -87,11 +94,14 @@ tasks.clean { } tasks.shadowJar { - val fileName = "OpenMC-${project.version}.jar" destinationDirectory.set(file("./builds/")) - archiveFileName.set(fileName) + archiveFileName.set("OpenMC.jar") } tasks.test { useJUnitPlatform() } + +test { useJUnitPlatform() } + +apply plugin: "com.github.johnrengelman.shadow" From 4848483497a3627b4be00474715fb111626fdfb9 Mon Sep 17 00:00:00 2001 From: iambibi_ <89582596+iambibi@users.noreply.github.com> Date: Mon, 21 Apr 2025 09:51:40 +0200 Subject: [PATCH 08/15] Update build.gradle --- build.gradle | 105 ++++++++++++++++++++++----------------------------- 1 file changed, 45 insertions(+), 60 deletions(-) diff --git a/build.gradle b/build.gradle index 134af7788..97227f4ae 100644 --- a/build.gradle +++ b/build.gradle @@ -1,22 +1,17 @@ plugins { - id("java") - id("com.github.johnrengelman.shadow") version "8.1.1" + id 'java' + id 'com.github.johnrengelman.shadow' version '8.1.1' } // Versioning -val pluginVersion = "2.0.0" -val gitHash = System.getenv("GITHUB_SHA") ?: "local" +def pluginVersion = '2.0.0' +def gitHash = System.getenv('GITHUB_SHA') ?: 'local' -// Déclaration du snapshot conditionnel -val isSnapshot = System.getenv("SNAPSHOT")?.toBoolean() ?: false +def isSnapshot = System.getenv('SNAPSHOT')?.toBoolean() ?: false -version = if (isSnapshot) { - "$pluginVersion-SNAPSHOT-${gitHash.take(7)}" -} else { - pluginVersion -} +version = isSnapshot ? "$pluginVersion-SNAPSHOT-${gitHash.take(7)}" : pluginVersion -group = "fr.openmc" +group = 'fr.openmc' repositories { mavenCentral() @@ -30,78 +25,68 @@ repositories { } dependencies { - compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT") - compileOnly("com.github.LoneDev6:API-ItemsAdder:3.6.3-beta-14") - compileOnly("net.luckperms:api:5.4") - compileOnly("me.clip:placeholderapi:2.11.6") - compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.9") - compileOnly("com.github.dmulloy2:ProtocolLib:-SNAPSHOT") - - implementation("de.rapha149.signgui:signgui:2.5.0") - implementation("dev.xernas:menulib:1.1.0") - implementation("org.jetbrains:annotations:24.1.0") - implementation("com.github.Revxrsal.Lamp:common:3.2.1") - implementation("com.github.Revxrsal.Lamp:bukkit:3.2.1") - implementation("net.raidstone:wgevents:1.18.1") - - compileOnly("org.projectlombok:lombok:1.18.34") - annotationProcessor("org.projectlombok:lombok:1.18.34") - testCompileOnly("org.projectlombok:lombok:1.18.34") - testAnnotationProcessor("org.projectlombok:lombok:1.18.34") - - testImplementation("org.slf4j:slf4j-simple:2.0.16") - testImplementation("org.junit.jupiter:junit-jupiter:5.11.0") - testRuntimeOnly("org.junit.platform:junit-platform-launcher") - testImplementation("org.mockbukkit.mockbukkit:mockbukkit-v1.21:4.45.0") - testImplementation("com.h2database:h2:2.3.232") + compileOnly 'io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT' + compileOnly 'com.github.LoneDev6:API-ItemsAdder:3.6.3-beta-14' + compileOnly 'net.luckperms:api:5.4' + compileOnly 'me.clip:placeholderapi:2.11.6' + compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.9' + compileOnly 'com.github.dmulloy2:ProtocolLib:-SNAPSHOT' + + implementation 'de.rapha149.signgui:signgui:2.5.0' + implementation 'dev.xernas:menulib:1.1.0' + implementation 'org.jetbrains:annotations:24.1.0' + implementation 'com.github.Revxrsal.Lamp:common:3.2.1' + implementation 'com.github.Revxrsal.Lamp:bukkit:3.2.1' + implementation 'net.raidstone:wgevents:1.18.1' + + compileOnly 'org.projectlombok:lombok:1.18.34' + annotationProcessor 'org.projectlombok:lombok:1.18.34' + testCompileOnly 'org.projectlombok:lombok:1.18.34' + testAnnotationProcessor 'org.projectlombok:lombok:1.18.34' + + testImplementation 'org.slf4j:slf4j-simple:2.0.16' + testImplementation 'org.junit.jupiter:junit-jupiter:5.11.0' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + testImplementation 'org.mockbukkit.mockbukkit:mockbukkit-v1.21:4.45.0' + testImplementation 'com.h2database:h2:2.3.232' } -val targetJavaVersion = 21 +def targetJavaVersion = 21 java { - val javaVersion = JavaVersion.toVersion(targetJavaVersion) - sourceCompatibility = javaVersion - targetCompatibility = javaVersion - if (JavaVersion.current() < javaVersion) { - toolchain.languageVersion.set(JavaLanguageVersion.of(targetJavaVersion)) - } + sourceCompatibility = targetJavaVersion + targetCompatibility = targetJavaVersion } -tasks.withType().configureEach { - options.encoding = "UTF-8" - if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible) { - options.release.set(targetJavaVersion) - } +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' + options.release = targetJavaVersion } processResources { - val props = mapOf("version" to version) + def props = ["version": version] inputs.properties(props) - filteringCharset = "UTF-8" - filesMatching("paper-plugin.yml") { + filteringCharset = 'UTF-8' + filesMatching('paper-plugin.yml') { expand(props) } } tasks.jar { manifest { - attributes["GIT-COMMIT"] = gitHash + attributes 'GIT-COMMIT': gitHash } - destinationDirectory.set(file("./builds/")) + destinationDirectory.set(file('./builds/')) } tasks.clean { - delete("builds") + delete 'builds' } tasks.shadowJar { - destinationDirectory.set(file("./builds/")) - archiveFileName.set("OpenMC.jar") + destinationDirectory.set(file('./builds/')) + archiveFileName.set('OpenMC.jar') } tasks.test { useJUnitPlatform() } - -test { useJUnitPlatform() } - -apply plugin: "com.github.johnrengelman.shadow" From db83226adbf9be08dff5f59e4bee19c2f1262fa1 Mon Sep 17 00:00:00 2001 From: iambibi_ <89582596+iambibi@users.noreply.github.com> Date: Mon, 21 Apr 2025 09:53:55 +0200 Subject: [PATCH 09/15] Update build.gradle --- build.gradle | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 97227f4ae..228b4403d 100644 --- a/build.gradle +++ b/build.gradle @@ -15,15 +15,30 @@ group = 'fr.openmc' repositories { mavenCentral() - maven("https://repo.papermc.io/repository/maven-public/") - maven("https://oss.sonatype.org/content/groups/public/") - maven("https://mvn.mathiasd.fr/releases") - maven("https://maven.enginehub.org/repo/") - maven("https://repo.extendedclip.com/content/repositories/placeholderapi/") - maven("https://repo.dmulloy2.net/repository/public/") - maven("https://jitpack.io") // Toujours à la fin + maven { + url "https://repo.papermc.io/repository/maven-public/" + } + maven { + url "https://oss.sonatype.org/content/groups/public/" + } + maven { + url "https://mvn.mathiasd.fr/releases" + } + maven { + url "https://maven.enginehub.org/repo/" + } + maven { + url "https://repo.extendedclip.com/content/repositories/placeholderapi/" + } + maven { + url "https://repo.dmulloy2.net/repository/public/" + } + maven { + url "https://jitpack.io" // Toujours à la fin + } } + dependencies { compileOnly 'io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT' compileOnly 'com.github.LoneDev6:API-ItemsAdder:3.6.3-beta-14' From c0f4948fdd97c7120917262f1d945b0c9bbffa30 Mon Sep 17 00:00:00 2001 From: iambibi_ <89582596+iambibi@users.noreply.github.com> Date: Mon, 21 Apr 2025 10:22:28 +0200 Subject: [PATCH 10/15] Update release.yml --- .github/workflows/release.yml | 53 ++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc97037f2..142d0e122 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,43 +1,46 @@ -name: Release Stable Version +name: Release Stable Jar on: milestone: types: [closed] jobs: - release_stable: - name: Release Stable Jar + build: + if: startsWith(github.event.milestone.title, '2.0.0') || github.event.milestone.title =~ '^\\d+\\.\\d+\\.\\d+(-beta)?$' runs-on: ubuntu-latest - permissions: write-all + env: + plugin_version: ${{ github.event.milestone.title }} + steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 + - uses: actions/checkout@v4 - - name: Setup JDK - uses: actions/setup-java@v2 + - name: Setup Java + uses: actions/setup-java@v4 with: - distribution: 'adopt' - java-version: '21' + distribution: 'temurin' + java-version: 17 + + - name: Make Gradle executable + run: chmod +x ./gradlew - - name: Build stable JAR + - name: Build with Gradle run: | - chmod +x ./gradlew - ./gradlew shadowJar -DPLUGIN_VERSION=${{ github.event.milestone.title }} -DSNAPSHOT=false - env: - GITHUB_SHA: ${{ github.sha }} + SNAPSHOT_BUILD=false ./gradlew shadowJar - - name: Rename Jar + - name: Prepare JAR run: | mkdir -p release - mv builds/OpenMC-${{ github.event.milestone.title }}.jar release/OpenMC-${{ github.event.milestone.title }}.jar + cp builds/OpenMC-${{ env.plugin_version }}.jar release/ + + - name: Upload JAR + uses: actions/upload-artifact@v4 + with: + name: OpenMC-${{ env.plugin_version }}.jar + path: release/OpenMC-${{ env.plugin_version }}.jar - - name: Create GitHub Release + - name: Create Release uses: softprops/action-gh-release@v1 with: - name: OpenMC ${{ github.event.milestone.title }} - tag_name: v${{ github.event.milestone.title }} - files: release/OpenMC-${{ github.event.milestone.title }}.jar - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + name: OpenMC ${{ env.plugin_version }} + tag_name: v${{ env.plugin_version }} + files: release/OpenMC-${{ env.plugin_version }}.jar From 6d639f576187fbff82d68399ed93ffe66df7337c Mon Sep 17 00:00:00 2001 From: iambibi_ <89582596+iambibi@users.noreply.github.com> Date: Mon, 21 Apr 2025 10:22:47 +0200 Subject: [PATCH 11/15] Update release.yml --- .github/workflows/release.yml | 41 ++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 142d0e122..543aaeb03 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,41 +6,42 @@ on: jobs: build: - if: startsWith(github.event.milestone.title, '2.0.0') || github.event.milestone.title =~ '^\\d+\\.\\d+\\.\\d+(-beta)?$' + if: startsWith(github.event.milestone.title, '2.') # Evite =~ qui n'existe pas ici runs-on: ubuntu-latest + env: - plugin_version: ${{ github.event.milestone.title }} + SNAPSHOT: false steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 - - name: Setup Java + - name: Set up JDK 21 uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: 17 + java-version: 21 - - name: Make Gradle executable + - name: Grant execute permission for Gradle run: chmod +x ./gradlew - name: Build with Gradle - run: | - SNAPSHOT_BUILD=false ./gradlew shadowJar + run: ./gradlew clean shadowJar - - name: Prepare JAR - run: | - mkdir -p release - cp builds/OpenMC-${{ env.plugin_version }}.jar release/ + - name: Create Release directory + run: mkdir -p release && mv builds/OpenMC.jar release/OpenMC-${{ github.event.milestone.title }}.jar - - name: Upload JAR + - name: Upload Release Artifact uses: actions/upload-artifact@v4 with: - name: OpenMC-${{ env.plugin_version }}.jar - path: release/OpenMC-${{ env.plugin_version }}.jar + name: OpenMC-${{ github.event.milestone.title }} + path: release/OpenMC-${{ github.event.milestone.title }}.jar - - name: Create Release - uses: softprops/action-gh-release@v1 + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 with: - name: OpenMC ${{ env.plugin_version }} - tag_name: v${{ env.plugin_version }} - files: release/OpenMC-${{ env.plugin_version }}.jar + name: OpenMC ${{ github.event.milestone.title }} + tag_name: ${{ github.event.milestone.title }} + files: release/OpenMC-${{ github.event.milestone.title }}.jar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 9ca7f8abedfde14ec560cea6399b11e0a5a52656 Mon Sep 17 00:00:00 2001 From: iambibi_ <89582596+iambibi@users.noreply.github.com> Date: Mon, 21 Apr 2025 10:24:49 +0200 Subject: [PATCH 12/15] Update build.gradle --- build.gradle | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 228b4403d..6975bc933 100644 --- a/build.gradle +++ b/build.gradle @@ -6,11 +6,9 @@ plugins { // Versioning def pluginVersion = '2.0.0' def gitHash = System.getenv('GITHUB_SHA') ?: 'local' - def isSnapshot = System.getenv('SNAPSHOT')?.toBoolean() ?: false version = isSnapshot ? "$pluginVersion-SNAPSHOT-${gitHash.take(7)}" : pluginVersion - group = 'fr.openmc' repositories { @@ -38,7 +36,6 @@ repositories { } } - dependencies { compileOnly 'io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT' compileOnly 'com.github.LoneDev6:API-ItemsAdder:3.6.3-beta-14' @@ -105,3 +102,4 @@ tasks.shadowJar { tasks.test { useJUnitPlatform() } + From 1cb5438fbda3eb99a3e0481551eeb9869e7bf710 Mon Sep 17 00:00:00 2001 From: iambibi_ <89582596+iambibi@users.noreply.github.com> Date: Mon, 21 Apr 2025 10:35:40 +0200 Subject: [PATCH 13/15] Update release.yml --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 543aaeb03..cb7357737 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,9 @@ on: milestone: types: [closed] +permissions: + contents: write + jobs: build: if: startsWith(github.event.milestone.title, '2.') # Evite =~ qui n'existe pas ici From 3cdb494d83060a23392d2329f5b4872738a829b4 Mon Sep 17 00:00:00 2001 From: iambibi_ <89582596+iambibi@users.noreply.github.com> Date: Mon, 21 Apr 2025 10:42:44 +0200 Subject: [PATCH 14/15] Create pull-request-build.yml --- .github/workflows/pull-request-build.yml | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/pull-request-build.yml diff --git a/.github/workflows/pull-request-build.yml b/.github/workflows/pull-request-build.yml new file mode 100644 index 000000000..473f3f801 --- /dev/null +++ b/.github/workflows/pull-request-build.yml @@ -0,0 +1,37 @@ +name: Pull Request Build + +on: + pull_request: + types: [opened, synchronize, reopened] + +permissions: + contents: read + +jobs: + build-snapshot: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + + - name: Grant execute permission to Gradle + run: chmod +x ./gradlew + + - name: Set SNAPSHOT=true for versioning + run: echo "SNAPSHOT=true" >> $GITHUB_ENV + + - name: Build with snapshot version + env: + SNAPSHOT: true + GITHUB_SHA: ${{ github.sha }} + run: ./gradlew shadowJar + + - name: Show final jar file + run: ls -lh builds/ From 07e279220f0a8003ddc4a535c860c0cf4fa85097 Mon Sep 17 00:00:00 2001 From: iambibi_ <89582596+iambibi@users.noreply.github.com> Date: Mon, 21 Apr 2025 10:44:02 +0200 Subject: [PATCH 15/15] Update ListenersManager.java --- src/main/java/fr/openmc/core/ListenersManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/fr/openmc/core/ListenersManager.java b/src/main/java/fr/openmc/core/ListenersManager.java index 9460712b3..2eb3b4e7e 100644 --- a/src/main/java/fr/openmc/core/ListenersManager.java +++ b/src/main/java/fr/openmc/core/ListenersManager.java @@ -31,3 +31,4 @@ private void registerEvents(Listener... args) { } } } +