From 5b67c6441b28880ecdf5ba7c5630ccb33e5c3ff2 Mon Sep 17 00:00:00 2001 From: Piquel <63727792+PiquelChips@users.noreply.github.com> Date: Sun, 20 Apr 2025 09:21:12 +0200 Subject: [PATCH 01/81] fix: List.of() creates immutable list --- .../fr/openmc/core/features/city/commands/CityCommands.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/openmc/core/features/city/commands/CityCommands.java b/src/main/java/fr/openmc/core/features/city/commands/CityCommands.java index 2cd3b7232..dda4b3233 100644 --- a/src/main/java/fr/openmc/core/features/city/commands/CityCommands.java +++ b/src/main/java/fr/openmc/core/features/city/commands/CityCommands.java @@ -196,7 +196,9 @@ public static void add(Player sender, @Named("invité") Player target) { List playerInvitations = invitations.get(target); if (playerInvitations == null) { - invitations.put(target, List.of(sender)); + playerInvitations = new ArrayList<>(); + playerInvitations.add(sender); + invitations.put(target, playerInvitations); } else { playerInvitations.add(sender); } From 1c9ff25ea327ac73a7dcb8df7726b4d0a78f53a4 Mon Sep 17 00:00:00 2001 From: Piquel <63727792+PiquelChips@users.noreply.github.com> Date: Sun, 20 Apr 2025 09:29:49 +0200 Subject: [PATCH 02/81] fix: Rename invitation variable to avoid confusion --- .../fr/openmc/core/features/city/commands/CityCommands.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/openmc/core/features/city/commands/CityCommands.java b/src/main/java/fr/openmc/core/features/city/commands/CityCommands.java index dda4b3233..f2a74f57e 100644 --- a/src/main/java/fr/openmc/core/features/city/commands/CityCommands.java +++ b/src/main/java/fr/openmc/core/features/city/commands/CityCommands.java @@ -196,9 +196,9 @@ public static void add(Player sender, @Named("invité") Player target) { List playerInvitations = invitations.get(target); if (playerInvitations == null) { - playerInvitations = new ArrayList<>(); - playerInvitations.add(sender); - invitations.put(target, playerInvitations); + List newInvitations = new ArrayList<>(); + newInvitations.add(sender); + invitations.put(target, newInvitations); } else { playerInvitations.add(sender); } From aa00342ebaecb27f55b32a43765d81bdbb1ddb83 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Mon, 21 Apr 2025 14:57:24 +0200 Subject: [PATCH 03/81] feat: _iambibi's work from https://github.com/ServerOpenMC/PluginV2VersioningTest --- .github/workflows/check-milestone.yml | 19 ++++ .github/workflows/main.yml | 27 ++--- .github/workflows/pull-request-build.yml | 37 +++++++ .github/workflows/release.yml | 41 +++++++ .github/workflows/tag-on-merge.yml | 22 ++++ build.gradle | 135 +++++++++++++---------- src/main/resources/plugin.yml | 2 +- 7 files changed, 207 insertions(+), 76 deletions(-) create mode 100644 .github/workflows/check-milestone.yml create mode 100644 .github/workflows/pull-request-build.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/tag-on-merge.yml diff --git a/.github/workflows/check-milestone.yml b/.github/workflows/check-milestone.yml new file mode 100644 index 000000000..3ac49c795 --- /dev/null +++ b/.github/workflows/check-milestone.yml @@ -0,0 +1,19 @@ +name: Vérification du milestone + +on: + pull_request: + types: [opened, edited, reopened, synchronize] + +jobs: + check-milestone: + runs-on: ubuntu-latest + steps: + - name: Vérifier la présence d'un milestone + run: | + if [ "${{ github.event.pull_request.milestone }}" == "" ]; then + echo "❌ La PR n'est pas associée à un milestone." + exit 1 + else + echo "✅ Milestone détecté : ${{ github.event.pull_request.milestone.title }}" + fi + 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 + 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/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..e5a28c2d6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Release + +on: + push: + tags: + - '*' + +jobs: + build-release: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Build with Gradle + run: ./gradlew shadowJar + + - name: Create release folder + run: mkdir -p release && mv builds/OpenMC.jar release/OpenMC-${GITHUB_REF#refs/tags/}.jar + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: OpenMC-${{ github.ref_name }} + path: release/ + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: release/OpenMC-${{ github.ref_name }}.jar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tag-on-merge.yml b/.github/workflows/tag-on-merge.yml new file mode 100644 index 000000000..d5fcd4c91 --- /dev/null +++ b/.github/workflows/tag-on-merge.yml @@ -0,0 +1,22 @@ +name: Création de tag après merge + +on: + pull_request: + types: [closed] + +jobs: + create-tag: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - name: Extraire le nom du milestone + run: | + echo "Milestone : ${{ github.event.pull_request.milestone.title }}" + echo "TAG_NAME=${{ github.event.pull_request.milestone.title }}-${{ github.sha }}" >> $GITHUB_ENV + + - name: Créer et pousser le tag + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + git tag $TAG_NAME + git push origin $TAG_NAME diff --git a/build.gradle b/build.gradle index e6d6d2838..ee831dc31 100644 --- a/build.gradle +++ b/build.gradle @@ -1,93 +1,108 @@ plugins { id 'java' - id "com.github.johnrengelman.shadow" version "8.1.1" + id 'com.github.johnrengelman.shadow' version '8.1.1' } +// Versioning +def gitRef = System.getenv("GITHUB_REF") ?: "" +def tagVersion = gitRef.replace("refs/tags/", "") +def isSnapshot = System.getenv('SNAPSHOT')?.toBoolean() ?: false +def gitHash = System.getenv('GITHUB_SHA') ?: 'local' + +def pluginVersion = tagVersion ? tagVersion : "dev" + +version = isSnapshot ? "$pluginVersion-SNAPSHOT-${gitHash.take(7)}" : pluginVersion group = 'fr.openmc' -version = "GIT-"+System.getenv("GITHUB_SHA") ?: "unknown" 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 { + 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") - 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 - - 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 - - // 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") - 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' } def targetJavaVersion = 21 java { - def javaVersion = JavaVersion.toVersion(targetJavaVersion) - sourceCompatibility = javaVersion - targetCompatibility = javaVersion - if (JavaVersion.current() < javaVersion) { - toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) - } + sourceCompatibility = targetJavaVersion + targetCompatibility = targetJavaVersion } -tasks.withType(JavaCompile).configureEach { +tasks.withType(JavaCompile) { options.encoding = 'UTF-8' - - if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { - options.release.set(targetJavaVersion) - } + options.release = targetJavaVersion } processResources { - def props = [version: version] - inputs.properties props - filteringCharset 'UTF-8' + def props = ["version": version] + inputs.properties(props) + filteringCharset = 'UTF-8' filesMatching('paper-plugin.yml') { - expand props + expand(props) } } -jar { + +tasks.jar { manifest { - attributes("GIT-COMMIT" : System.getenv("GITHUB_SHA") ?: "unknown") + attributes 'GIT-COMMIT': gitHash } - destinationDirectory.set(file("./builds/")) + destinationDirectory.set(file('./builds/')) } -clean { - delete "builds" +tasks.clean { + delete 'builds' } -shadowJar { - destinationDirectory.set(file("./builds/")) - archiveFileName = "OpenMC.jar" +tasks.shadowJar { + destinationDirectory.set(file('./builds/')) + archiveFileName.set('OpenMC.jar') } -test { useJUnitPlatform() } +tasks.test { + useJUnitPlatform() +} -apply plugin: "com.github.johnrengelman.shadow" \ No newline at end of file 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 d11123b264aaa4a4d0039cce1fe37862b4834627 Mon Sep 17 00:00:00 2001 From: Piquel <63727792+PiquelChips@users.noreply.github.com> Date: Mon, 21 Apr 2025 15:03:13 +0200 Subject: [PATCH 04/81] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 45ab6004b..f2219b9ef 100644 --- a/README.md +++ b/README.md @@ -24,3 +24,5 @@ Projet sous [GPL-3.0 license](https://choosealicense.com/licenses/gpl-3.0/). --- Merci à @MathiasDPX pour la nouvelle configuration du repo. + +juste un test From 0a7969540b19292dd168d8fd5e1751c994f61134 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Mon, 21 Apr 2025 15:09:50 +0200 Subject: [PATCH 05/81] feat: fix creation of tag --- .github/workflows/tag-on-merge.yml | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tag-on-merge.yml b/.github/workflows/tag-on-merge.yml index d5fcd4c91..3ffca4d50 100644 --- a/.github/workflows/tag-on-merge.yml +++ b/.github/workflows/tag-on-merge.yml @@ -14,9 +14,20 @@ jobs: echo "Milestone : ${{ github.event.pull_request.milestone.title }}" echo "TAG_NAME=${{ github.event.pull_request.milestone.title }}-${{ github.sha }}" >> $GITHUB_ENV - - name: Créer et pousser le tag - run: | - git config user.name "GitHub Actions" - git config user.email "actions@github.com" - git tag $TAG_NAME - git push origin $TAG_NAME + # - name: Créer et pousser le tag + # run: | + # git config user.name "GitHub Actions" + # git config user.email "actions@github.com" + # git tag $TAG_NAME + # git push origin $TAG_NAME + + - name: Create tag + uses: actions/github-script@v5 + with: + script: | + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'refs/tags/$TAG_NAME', + sha: context.sha + }) From f1d8c36893cf2a838ac4b9b4e6657795735d2e22 Mon Sep 17 00:00:00 2001 From: Piquel <63727792+PiquelChips@users.noreply.github.com> Date: Mon, 21 Apr 2025 15:11:46 +0200 Subject: [PATCH 06/81] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f2219b9ef..034e82fa3 100644 --- a/README.md +++ b/README.md @@ -26,3 +26,4 @@ Projet sous [GPL-3.0 license](https://choosealicense.com/licenses/gpl-3.0/). Merci à @MathiasDPX pour la nouvelle configuration du repo. juste un test +un autre test From 50c18e5e5f340582dd7319802dcf36935788a911 Mon Sep 17 00:00:00 2001 From: Piquel <63727792+PiquelChips@users.noreply.github.com> Date: Mon, 21 Apr 2025 15:13:47 +0200 Subject: [PATCH 07/81] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 034e82fa3..5878d6e0a 100644 --- a/README.md +++ b/README.md @@ -27,3 +27,4 @@ Merci à @MathiasDPX pour la nouvelle configuration du repo. juste un test un autre test +encore un test From cc16f2ffff00a19bb14f370ae7cf62a1b11284af Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Mon, 21 Apr 2025 16:17:04 +0200 Subject: [PATCH 08/81] remove adding tags on merge --- .github/workflows/tag-on-merge.yml | 33 ------------------------------ build.gradle | 1 - 2 files changed, 34 deletions(-) delete mode 100644 .github/workflows/tag-on-merge.yml diff --git a/.github/workflows/tag-on-merge.yml b/.github/workflows/tag-on-merge.yml deleted file mode 100644 index 3ffca4d50..000000000 --- a/.github/workflows/tag-on-merge.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Création de tag après merge - -on: - pull_request: - types: [closed] - -jobs: - create-tag: - if: github.event.pull_request.merged == true - runs-on: ubuntu-latest - steps: - - name: Extraire le nom du milestone - run: | - echo "Milestone : ${{ github.event.pull_request.milestone.title }}" - echo "TAG_NAME=${{ github.event.pull_request.milestone.title }}-${{ github.sha }}" >> $GITHUB_ENV - - # - name: Créer et pousser le tag - # run: | - # git config user.name "GitHub Actions" - # git config user.email "actions@github.com" - # git tag $TAG_NAME - # git push origin $TAG_NAME - - - name: Create tag - uses: actions/github-script@v5 - with: - script: | - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: 'refs/tags/$TAG_NAME', - sha: context.sha - }) diff --git a/build.gradle b/build.gradle index ee831dc31..6c633ea08 100644 --- a/build.gradle +++ b/build.gradle @@ -105,4 +105,3 @@ tasks.shadowJar { tasks.test { useJUnitPlatform() } - From 8ccbae59c1825a8db78406db3f82c7cf53de3761 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Mon, 21 Apr 2025 16:19:14 +0200 Subject: [PATCH 09/81] feat: add merging of milestone branch into master on milestone close --- .github/workflows/release.yml | 67 +++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e5a28c2d6..2eaa171ca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,8 +10,63 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + # Auth token needed to create branches & merge PRs + token: ${{ secrets.GITHUB_TOKEN }} + + # Merge milestone branch into master + + - name: Get milestone information + id: milestone + run: | + # Convert milestone title to the corresponding branch name (same logic as in pr-closed.yml) + MILESTONE_TITLE="${{ github.event.milestone.title }}" + BRANCH_NAME=$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') + echo "milestone_branch=milestone-${BRANCH_NAME}" >> $GITHUB_OUTPUT + echo "milestone_title=$MILESTONE_TITLE" >> $GITHUB_OUTPUT + echo "milestone_description=${{ github.event.milestone.description }}" >> $GITHUB_OUTPUT + + - name: Configure Git + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + + - name: Check if milestone branch exists + id: check_branch + run: | + if git ls-remote --heads origin ${{ steps.milestone.outputs.milestone_branch }} | grep -q ${{ steps.milestone.outputs.milestone_branch }}; then + echo "exists=true" >> $GITHUB_OUTPUT + else + echo "exists=false" >> $GITHUB_OUTPUT + echo "No corresponding milestone branch found for ${{ steps.milestone.outputs.milestone_title }}, exiting." + exit 1 + fi + - name: Merge milestone into master + if: steps.check_branch.outputs.exists == 'true' + run: | + git checkout master + git pull origin master + + # Merge milestone branch into master + git merge --no-ff origin/${{ steps.milestone.outputs.milestone_branch }} -m "Merge milestone branch ${{ steps.milestone.outputs.milestone_branch }} into master upon milestone closure" + + git push origin master + echo "Merged milestone branch ${{ steps.milestone.outputs.milestone_branch }} into master" + + # Build the plugin and release it + + - name: Create release tag + id: tag + run: | + TAG_NAME="${{ steps.milestone.outputs.milestone_title }}" + git tag -a $TAG_NAME -m "Release ${{ steps.milestone.outputs.milestone_title }}" + git push origin $TAG_NAME + echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT + - name: Set up JDK 21 uses: actions/setup-java@v4 with: @@ -20,10 +75,8 @@ jobs: - name: Make gradlew executable run: chmod +x ./gradlew - - name: Build with Gradle run: ./gradlew shadowJar - - name: Create release folder run: mkdir -p release && mv builds/OpenMC.jar release/OpenMC-${GITHUB_REF#refs/tags/}.jar @@ -36,6 +89,14 @@ jobs: - name: Create GitHub Release uses: softprops/action-gh-release@v2 with: + tag_name: ${{ steps.tag.outputs.tag_name }} + name: Release ${{ steps.milestone.outputs.milestone_title }} + body: | + # Release ${{ steps.milestone.outputs.milestone_title }} + + ${{ steps.milestone.outputs.milestone_description }} + + This release was automatically created when milestone "${{ steps.milestone.outputs.milestone_title }}" was closed. files: release/OpenMC-${{ github.ref_name }}.jar env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From aa5ea48cbf6ef4101fbdefce2ba0c6bfaf9f8c0b Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Mon, 21 Apr 2025 16:33:15 +0200 Subject: [PATCH 10/81] feat: combined all build and test workflows --- .github/workflows/build-test.yml | 76 ++++++++++++++++++++++++ .github/workflows/main.yml | 45 -------------- .github/workflows/pull-request-build.yml | 37 ------------ .github/workflows/tests.yml | 35 ----------- 4 files changed, 76 insertions(+), 117 deletions(-) create mode 100644 .github/workflows/build-test.yml delete mode 100644 .github/workflows/main.yml delete mode 100644 .github/workflows/pull-request-build.yml delete mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 000000000..7383ba969 --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,76 @@ +name: Build & Test + +on: + pull_request: + paths-ignore: + - '.github/**' + - '.gitignore' + - 'LICENSE' + - 'README.md' + push: + paths-ignore: + - '.github/**' + - '.gitignore' + - 'LICENSE' + - 'README.md' + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Run Tests with Gradle + run: ./gradlew test + + - name: Report test results + uses: dorny/test-reporter@v2 + if: always() + with: + name: Gradle Tests + path: build/test-results/test/*.xml + reporter: java-junit + fail-on-error: true + + build: + name: Build + runs-on: ubuntu-latest + permissions: write-all + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Build with snapshot version + env: + SNAPSHOT: true + GITHUB_SHA: ${{ github.sha }} + run: ./gradlew jar + + - name: Upload Plugin jar + uses: actions/upload-artifact@v4 + with: + name: OpenMC-${{ github.sha }} + path: builds/OpenMC-*.jar + diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index fb4131917..000000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Build DEV Jars - -on: - pull_request: - paths-ignore: - - '.github/**' - - '.gitignore' - - 'LICENSE' - - 'README.md' - push: - paths-ignore: - - '.github/**' - - '.gitignore' - - 'LICENSE' - - 'README.md' - -jobs: - build_dev_jars: - name: Build DEV jars - 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 with Gradle - run: | - chmod +x ./gradlew - ./gradlew shadowJar -DPLUGIN_VERSION=2.0.0 -DSNAPSHOT=true - env: - GITHUB_SHA: ${{ github.sha }} - - - name: Upload Plugin jar - uses: actions/upload-artifact@v4 - with: - name: OpenMC-${{ github.sha }} - path: builds/OpenMC-*.jar - diff --git a/.github/workflows/pull-request-build.yml b/.github/workflows/pull-request-build.yml deleted file mode 100644 index 473f3f801..000000000 --- a/.github/workflows/pull-request-build.yml +++ /dev/null @@ -1,37 +0,0 @@ -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/ diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 5ac9a6ac0..000000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Gradle tests - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up JDK 21 - uses: actions/setup-java@v3 - with: - java-version: '21' - distribution: 'temurin' - - - name: Run Tests with Gradle - run: ./gradlew test - - - name: Report test results - uses: dorny/test-reporter@v2 - if: always() - with: - name: Gradle Tests - path: build/test-results/test/*.xml - reporter: java-junit - fail-on-error: true \ No newline at end of file From ecc01957988f01ef0c6f0de8fc040363064d32ca Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Mon, 21 Apr 2025 16:38:22 +0200 Subject: [PATCH 11/81] fix: clean up workflows and translate --- .github/workflows/build-test.yml | 1 - .github/workflows/check-milestone.yml | 6 +++--- .github/workflows/{release.yml => milestone-close.yml} | 8 +++----- 3 files changed, 6 insertions(+), 9 deletions(-) rename .github/workflows/{release.yml => milestone-close.yml} (97%) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 7383ba969..e85a77d60 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -73,4 +73,3 @@ jobs: with: name: OpenMC-${{ github.sha }} path: builds/OpenMC-*.jar - diff --git a/.github/workflows/check-milestone.yml b/.github/workflows/check-milestone.yml index 3ac49c795..dd2558ca3 100644 --- a/.github/workflows/check-milestone.yml +++ b/.github/workflows/check-milestone.yml @@ -8,12 +8,12 @@ jobs: check-milestone: runs-on: ubuntu-latest steps: - - name: Vérifier la présence d'un milestone + - name: Verify that PR has been assigned a milestone run: | if [ "${{ github.event.pull_request.milestone }}" == "" ]; then - echo "❌ La PR n'est pas associée à un milestone." + echo "❌ PR has not been assigned a milestone." exit 1 else - echo "✅ Milestone détecté : ${{ github.event.pull_request.milestone.title }}" + echo "✅ Milestone detected: ${{ github.event.pull_request.milestone.title }}" fi diff --git a/.github/workflows/release.yml b/.github/workflows/milestone-close.yml similarity index 97% rename from .github/workflows/release.yml rename to .github/workflows/milestone-close.yml index 2eaa171ca..0cbe0ccdb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/milestone-close.yml @@ -1,9 +1,8 @@ -name: Release +name: Handle closing a milestone on: - push: - tags: - - '*' + milestone: + types: [closed] jobs: build-release: @@ -14,7 +13,6 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - # Auth token needed to create branches & merge PRs token: ${{ secrets.GITHUB_TOKEN }} # Merge milestone branch into master From a7abbaadf8ecc2e6d10b2007697decaa0a811757 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Mon, 21 Apr 2025 16:47:44 +0200 Subject: [PATCH 12/81] feat: merge PR into milestone branch --- .github/workflows/milestone-close.yml | 2 +- .github/workflows/pr-close.yml | 65 +++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pr-close.yml diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 0cbe0ccdb..fc9bcdecd 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -20,7 +20,7 @@ jobs: - name: Get milestone information id: milestone run: | - # Convert milestone title to the corresponding branch name (same logic as in pr-closed.yml) + # Convert milestone title to the corresponding branch name (same logic as in pr-close.yml) MILESTONE_TITLE="${{ github.event.milestone.title }}" BRANCH_NAME=$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') echo "milestone_branch=milestone-${BRANCH_NAME}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/pr-close.yml b/.github/workflows/pr-close.yml new file mode 100644 index 000000000..5a9ce3261 --- /dev/null +++ b/.github/workflows/pr-close.yml @@ -0,0 +1,65 @@ +name: Handle PR close + +on: + pull_request: + types: [closed] + branches: + - master + +jobs: + merge-to-milestone-branch: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Get milestone information + id: milestone + run: | + if [ -z "${{ github.event.pull_request.milestone.title }}" ]; then + echo "No milestone assigned to this PR, failing workflow." + exit 1 + else + # Convert milestone title to the corresponding branch name (same logic as in milestone-close.yml) + MILESTONE_TITLE="${{ github.event.pull_request.milestone.title }}" + BRANCH_NAME=$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') + echo "milestone_branch=milestone-${BRANCH_NAME}" >> $GITHUB_OUTPUT + echo "milestone_title=$MILESTONE_TITLE" >> $GITHUB_OUTPUT + fi + + - name: Configure Git + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + + - name: Check if milestone branch exists + id: check_branch + run: | + if git ls-remote --heads origin ${{ steps.milestone.outputs.milestone_branch }} | grep -q ${{ steps.milestone.outputs.milestone_branch }}; then + echo "exists=true" >> $GITHUB_OUTPUT + else + echo "exists=false" >> $GITHUB_OUTPUT + fi + + - name: Create milestone branch if it doesn't exist + if: steps.check_branch.outputs.exists == 'false' + run: | + git checkout -b ${{ steps.milestone.outputs.milestone_branch }} + git push -u origin ${{ steps.milestone.outputs.milestone_branch }} + echo "Created new milestone branch: ${{ steps.milestone.outputs.milestone_branch }}" + + - name: Merge PR changes to milestone branch + run: | + if [ "${{ steps.check_branch.outputs.exists }}" == "true" ]; then + git checkout ${{ steps.milestone.outputs.milestone_branch }} + git pull origin ${{ steps.milestone.outputs.milestone_branch }} + fi + + PR_COMMIT=${{ github.event.pull_request.merge_commit_sha }} + + git merge --no-ff $PR_COMMIT -m "Merge PR #${{ github.event.pull_request.number }} into ${{ steps.milestone.outputs.milestone_branch }}" + git push origin ${{ steps.milestone.outputs.milestone_branch }} From 44c55a9bee9b6248633e9f50da38cb0459973f36 Mon Sep 17 00:00:00 2001 From: Piquel <63727792+PiquelChips@users.noreply.github.com> Date: Mon, 21 Apr 2025 16:57:05 +0200 Subject: [PATCH 13/81] Plus de tests --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 5878d6e0a..45ab6004b 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,3 @@ Projet sous [GPL-3.0 license](https://choosealicense.com/licenses/gpl-3.0/). --- Merci à @MathiasDPX pour la nouvelle configuration du repo. - -juste un test -un autre test -encore un test From cdfa75864d2c378ab97c58d7f473b2378866a27d Mon Sep 17 00:00:00 2001 From: Piquel <63727792+PiquelChips@users.noreply.github.com> Date: Mon, 21 Apr 2025 17:07:06 +0200 Subject: [PATCH 14/81] Update README.md (#5) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 45ab6004b..f2219b9ef 100644 --- a/README.md +++ b/README.md @@ -24,3 +24,5 @@ Projet sous [GPL-3.0 license](https://choosealicense.com/licenses/gpl-3.0/). --- Merci à @MathiasDPX pour la nouvelle configuration du repo. + +juste un test From 71435665dfb1e0fafa2b71bc33536d64e94b8962 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Mon, 21 Apr 2025 17:31:17 +0200 Subject: [PATCH 15/81] remove pr-close workflow --- .github/workflows/pr-close.yml | 65 ---------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 .github/workflows/pr-close.yml diff --git a/.github/workflows/pr-close.yml b/.github/workflows/pr-close.yml deleted file mode 100644 index 5a9ce3261..000000000 --- a/.github/workflows/pr-close.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: Handle PR close - -on: - pull_request: - types: [closed] - branches: - - master - -jobs: - merge-to-milestone-branch: - if: github.event.pull_request.merged == true - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Get milestone information - id: milestone - run: | - if [ -z "${{ github.event.pull_request.milestone.title }}" ]; then - echo "No milestone assigned to this PR, failing workflow." - exit 1 - else - # Convert milestone title to the corresponding branch name (same logic as in milestone-close.yml) - MILESTONE_TITLE="${{ github.event.pull_request.milestone.title }}" - BRANCH_NAME=$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') - echo "milestone_branch=milestone-${BRANCH_NAME}" >> $GITHUB_OUTPUT - echo "milestone_title=$MILESTONE_TITLE" >> $GITHUB_OUTPUT - fi - - - name: Configure Git - run: | - git config user.name "GitHub Actions" - git config user.email "actions@github.com" - - - name: Check if milestone branch exists - id: check_branch - run: | - if git ls-remote --heads origin ${{ steps.milestone.outputs.milestone_branch }} | grep -q ${{ steps.milestone.outputs.milestone_branch }}; then - echo "exists=true" >> $GITHUB_OUTPUT - else - echo "exists=false" >> $GITHUB_OUTPUT - fi - - - name: Create milestone branch if it doesn't exist - if: steps.check_branch.outputs.exists == 'false' - run: | - git checkout -b ${{ steps.milestone.outputs.milestone_branch }} - git push -u origin ${{ steps.milestone.outputs.milestone_branch }} - echo "Created new milestone branch: ${{ steps.milestone.outputs.milestone_branch }}" - - - name: Merge PR changes to milestone branch - run: | - if [ "${{ steps.check_branch.outputs.exists }}" == "true" ]; then - git checkout ${{ steps.milestone.outputs.milestone_branch }} - git pull origin ${{ steps.milestone.outputs.milestone_branch }} - fi - - PR_COMMIT=${{ github.event.pull_request.merge_commit_sha }} - - git merge --no-ff $PR_COMMIT -m "Merge PR #${{ github.event.pull_request.number }} into ${{ steps.milestone.outputs.milestone_branch }}" - git push origin ${{ steps.milestone.outputs.milestone_branch }} From 1d8d0bc7828865e1e24faff153fbe58a0a8d028b Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Mon, 21 Apr 2025 17:36:31 +0200 Subject: [PATCH 16/81] feat: check if target branch is correct --- .github/workflows/check-milestone.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-milestone.yml b/.github/workflows/check-milestone.yml index dd2558ca3..93bf09688 100644 --- a/.github/workflows/check-milestone.yml +++ b/.github/workflows/check-milestone.yml @@ -1,4 +1,4 @@ -name: Vérification du milestone +name: Check that milestone & target branch are correct on: pull_request: @@ -16,4 +16,14 @@ jobs: else echo "✅ Milestone detected: ${{ github.event.pull_request.milestone.title }}" fi + - name: Verify target branch is correct milestone + run: | + MILESTONE_TITLE="${{ github.event.milestone.title }}" + BRANCH_NAME=milestone-$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') + if [ "${{ github.event.pull_request.base.ref }}" == "$BRANCH_NAME" ]; then + echo "✅ Target branch is correct milestone branch" + else + echo "❌ Target branch is not Milestone branch. It shoudl be $BRANCH_NAME" + exit 1 + fi From e7659c2f1923df9c0c0dfb8355d2c9b7ef04ab24 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Mon, 21 Apr 2025 17:38:06 +0200 Subject: [PATCH 17/81] fix typo --- .github/workflows/check-milestone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-milestone.yml b/.github/workflows/check-milestone.yml index 93bf09688..79482128f 100644 --- a/.github/workflows/check-milestone.yml +++ b/.github/workflows/check-milestone.yml @@ -18,12 +18,12 @@ jobs: fi - name: Verify target branch is correct milestone run: | - MILESTONE_TITLE="${{ github.event.milestone.title }}" + MILESTONE_TITLE="${{ github.pull_request.milestone.title }}" BRANCH_NAME=milestone-$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') if [ "${{ github.event.pull_request.base.ref }}" == "$BRANCH_NAME" ]; then echo "✅ Target branch is correct milestone branch" else - echo "❌ Target branch is not Milestone branch. It shoudl be $BRANCH_NAME" + echo "❌ Target branch is not Milestone branch. It should be $BRANCH_NAME" exit 1 fi From d474e0cdfcbcffbed0d876ba6996e0e5000dd9ba Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Mon, 21 Apr 2025 17:39:14 +0200 Subject: [PATCH 18/81] fix typo --- .github/workflows/check-milestone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-milestone.yml b/.github/workflows/check-milestone.yml index 79482128f..953e03afb 100644 --- a/.github/workflows/check-milestone.yml +++ b/.github/workflows/check-milestone.yml @@ -18,7 +18,7 @@ jobs: fi - name: Verify target branch is correct milestone run: | - MILESTONE_TITLE="${{ github.pull_request.milestone.title }}" + MILESTONE_TITLE="${{ github.event.pull_request.milestone.title }}" BRANCH_NAME=milestone-$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') if [ "${{ github.event.pull_request.base.ref }}" == "$BRANCH_NAME" ]; then echo "✅ Target branch is correct milestone branch" From 0260180eaf0f0fc79ca16c3ccce58b5683ce7fb2 Mon Sep 17 00:00:00 2001 From: Piquel <63727792+PiquelChips@users.noreply.github.com> Date: Mon, 21 Apr 2025 17:41:58 +0200 Subject: [PATCH 19/81] Feat (#7) * remove pr-close workflow * feat: check if target branch is correct * fix typo * fix typo --- .github/workflows/check-milestone.yml | 12 ++++- .github/workflows/pr-close.yml | 65 --------------------------- 2 files changed, 11 insertions(+), 66 deletions(-) delete mode 100644 .github/workflows/pr-close.yml diff --git a/.github/workflows/check-milestone.yml b/.github/workflows/check-milestone.yml index dd2558ca3..953e03afb 100644 --- a/.github/workflows/check-milestone.yml +++ b/.github/workflows/check-milestone.yml @@ -1,4 +1,4 @@ -name: Vérification du milestone +name: Check that milestone & target branch are correct on: pull_request: @@ -16,4 +16,14 @@ jobs: else echo "✅ Milestone detected: ${{ github.event.pull_request.milestone.title }}" fi + - name: Verify target branch is correct milestone + run: | + MILESTONE_TITLE="${{ github.event.pull_request.milestone.title }}" + BRANCH_NAME=milestone-$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') + if [ "${{ github.event.pull_request.base.ref }}" == "$BRANCH_NAME" ]; then + echo "✅ Target branch is correct milestone branch" + else + echo "❌ Target branch is not Milestone branch. It should be $BRANCH_NAME" + exit 1 + fi diff --git a/.github/workflows/pr-close.yml b/.github/workflows/pr-close.yml deleted file mode 100644 index 5a9ce3261..000000000 --- a/.github/workflows/pr-close.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: Handle PR close - -on: - pull_request: - types: [closed] - branches: - - master - -jobs: - merge-to-milestone-branch: - if: github.event.pull_request.merged == true - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Get milestone information - id: milestone - run: | - if [ -z "${{ github.event.pull_request.milestone.title }}" ]; then - echo "No milestone assigned to this PR, failing workflow." - exit 1 - else - # Convert milestone title to the corresponding branch name (same logic as in milestone-close.yml) - MILESTONE_TITLE="${{ github.event.pull_request.milestone.title }}" - BRANCH_NAME=$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') - echo "milestone_branch=milestone-${BRANCH_NAME}" >> $GITHUB_OUTPUT - echo "milestone_title=$MILESTONE_TITLE" >> $GITHUB_OUTPUT - fi - - - name: Configure Git - run: | - git config user.name "GitHub Actions" - git config user.email "actions@github.com" - - - name: Check if milestone branch exists - id: check_branch - run: | - if git ls-remote --heads origin ${{ steps.milestone.outputs.milestone_branch }} | grep -q ${{ steps.milestone.outputs.milestone_branch }}; then - echo "exists=true" >> $GITHUB_OUTPUT - else - echo "exists=false" >> $GITHUB_OUTPUT - fi - - - name: Create milestone branch if it doesn't exist - if: steps.check_branch.outputs.exists == 'false' - run: | - git checkout -b ${{ steps.milestone.outputs.milestone_branch }} - git push -u origin ${{ steps.milestone.outputs.milestone_branch }} - echo "Created new milestone branch: ${{ steps.milestone.outputs.milestone_branch }}" - - - name: Merge PR changes to milestone branch - run: | - if [ "${{ steps.check_branch.outputs.exists }}" == "true" ]; then - git checkout ${{ steps.milestone.outputs.milestone_branch }} - git pull origin ${{ steps.milestone.outputs.milestone_branch }} - fi - - PR_COMMIT=${{ github.event.pull_request.merge_commit_sha }} - - git merge --no-ff $PR_COMMIT -m "Merge PR #${{ github.event.pull_request.number }} into ${{ steps.milestone.outputs.milestone_branch }}" - git push origin ${{ steps.milestone.outputs.milestone_branch }} From 9799b53ab256f99a95a6505457df06ab9e49e389 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Mon, 21 Apr 2025 21:57:38 +0200 Subject: [PATCH 20/81] clean check-milestone --- .github/workflows/check-milestone.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-milestone.yml b/.github/workflows/check-milestone.yml index 953e03afb..87222b600 100644 --- a/.github/workflows/check-milestone.yml +++ b/.github/workflows/check-milestone.yml @@ -6,6 +6,7 @@ on: jobs: check-milestone: + name: Does PR have a milestone runs-on: ubuntu-latest steps: - name: Verify that PR has been assigned a milestone @@ -13,17 +14,17 @@ jobs: if [ "${{ github.event.pull_request.milestone }}" == "" ]; then echo "❌ PR has not been assigned a milestone." exit 1 - else - echo "✅ Milestone detected: ${{ github.event.pull_request.milestone.title }}" fi + check-target: + name: Is target branch the milestone branch + runs-on: ubuntu-latest + steps: - name: Verify target branch is correct milestone run: | MILESTONE_TITLE="${{ github.event.pull_request.milestone.title }}" BRANCH_NAME=milestone-$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') - if [ "${{ github.event.pull_request.base.ref }}" == "$BRANCH_NAME" ]; then - echo "✅ Target branch is correct milestone branch" - else - echo "❌ Target branch is not Milestone branch. It should be $BRANCH_NAME" + if [ "${{ github.event.pull_request.base.ref }}" != "$BRANCH_NAME" ]; then + echo "❌ Target branch is not Milestone branch. It should be $BRANCH_NAME" exit 1 exit 1 fi From 6aeda2d6ab11b21400b4844adf729f7d7c376a20 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Mon, 21 Apr 2025 22:06:11 +0200 Subject: [PATCH 21/81] feat: milestone-create workflow --- .github/workflows/check-milestone.yml | 2 +- .github/workflows/milestone-create.yml | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/milestone-create.yml diff --git a/.github/workflows/check-milestone.yml b/.github/workflows/check-milestone.yml index 87222b600..0370c0391 100644 --- a/.github/workflows/check-milestone.yml +++ b/.github/workflows/check-milestone.yml @@ -1,4 +1,4 @@ -name: Check that milestone & target branch are correct +name: Milestone Checks on: pull_request: diff --git a/.github/workflows/milestone-create.yml b/.github/workflows/milestone-create.yml new file mode 100644 index 000000000..30df868ce --- /dev/null +++ b/.github/workflows/milestone-create.yml @@ -0,0 +1,25 @@ +name: Handle creating a milestone + +on: + milestone: + types: [created] + +jobs: + create-branch: + name: created associated branch + runs-on: ubuntu-latest + steps: + # Just so that git is setup for us + - name: Checkout repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Create branch + run: | + # Convert milestone title to the corresponding branch name (same logic as in milestone-close.yml) + MILESTONE_TITLE="${{ github.event.milestone.title }}" + BRANCH_NAME=$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') + + git checkout -b $BRANCH_NAME + git push -u origin $BRANCH_NAME From 51afec729bdbe648dc7e991ebddea057a5ec0649 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Tue, 22 Apr 2025 08:37:40 +0200 Subject: [PATCH 22/81] feat: add deleting branch when milestone-closed --- .github/workflows/milestone-close.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index fc9bcdecd..742b75511 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -98,3 +98,6 @@ jobs: files: release/OpenMC-${{ github.ref_name }}.jar env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Delete branch + run: git push origin --delete ${{ steps.milestone.outputs.milestone_branch }} From 09f9d952e8aed0bbc62e851931ef8f6debd6076d Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Tue, 22 Apr 2025 08:43:23 +0200 Subject: [PATCH 23/81] clean up milestone workflows --- .github/workflows/milestone-close.yml | 14 ++------------ .github/workflows/milestone-create.yml | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 742b75511..b6a580b6b 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -6,6 +6,7 @@ on: jobs: build-release: + name: Release & Deletee branch runs-on: ubuntu-latest steps: @@ -32,17 +33,6 @@ jobs: git config user.name "GitHub Actions" git config user.email "actions@github.com" - - name: Check if milestone branch exists - id: check_branch - run: | - if git ls-remote --heads origin ${{ steps.milestone.outputs.milestone_branch }} | grep -q ${{ steps.milestone.outputs.milestone_branch }}; then - echo "exists=true" >> $GITHUB_OUTPUT - else - echo "exists=false" >> $GITHUB_OUTPUT - echo "No corresponding milestone branch found for ${{ steps.milestone.outputs.milestone_title }}, exiting." - exit 1 - fi - - name: Merge milestone into master if: steps.check_branch.outputs.exists == 'true' run: | @@ -98,6 +88,6 @@ jobs: files: release/OpenMC-${{ github.ref_name }}.jar env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + - name: Delete branch run: git push origin --delete ${{ steps.milestone.outputs.milestone_branch }} diff --git a/.github/workflows/milestone-create.yml b/.github/workflows/milestone-create.yml index 30df868ce..ec884d257 100644 --- a/.github/workflows/milestone-create.yml +++ b/.github/workflows/milestone-create.yml @@ -6,7 +6,7 @@ on: jobs: create-branch: - name: created associated branch + name: Create associated branch runs-on: ubuntu-latest steps: # Just so that git is setup for us From b95eb27726bcb848545f1f069e96d058c1bcf8c7 Mon Sep 17 00:00:00 2001 From: Piquel <63727792+PiquelChips@users.noreply.github.com> Date: Tue, 22 Apr 2025 08:46:15 +0200 Subject: [PATCH 24/81] Feat (#8) * remove pr-close workflow * feat: check if target branch is correct * fix typo * fix typo * clean check-milestone * feat: milestone-create workflow * feat: add deleting branch when milestone-closed * clean up milestone workflows --- .github/workflows/check-milestone.yml | 17 ++++++++++++++--- .github/workflows/milestone-close.yml | 15 ++++----------- .github/workflows/milestone-create.yml | 25 +++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/milestone-create.yml diff --git a/.github/workflows/check-milestone.yml b/.github/workflows/check-milestone.yml index 953e03afb..d1e545f38 100644 --- a/.github/workflows/check-milestone.yml +++ b/.github/workflows/check-milestone.yml @@ -1,4 +1,4 @@ -name: Check that milestone & target branch are correct +name: Milestone Checks on: pull_request: @@ -6,6 +6,7 @@ on: jobs: check-milestone: + name: Does PR have a milestone runs-on: ubuntu-latest steps: - name: Verify that PR has been assigned a milestone @@ -13,8 +14,18 @@ jobs: if [ "${{ github.event.pull_request.milestone }}" == "" ]; then echo "❌ PR has not been assigned a milestone." exit 1 - else - echo "✅ Milestone detected: ${{ github.event.pull_request.milestone.title }}" + fi + check-target: + name: Is target branch the milestone branch + runs-on: ubuntu-latest + steps: + - name: Verify target branch is correct milestone + run: | + MILESTONE_TITLE="${{ github.event.pull_request.milestone.title }}" + BRANCH_NAME=milestone-$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') + if [ "${{ github.event.pull_request.base.ref }}" != "$BRANCH_NAME" ]; then + echo "❌ Target branch is not Milestone branch. It should be $BRANCH_NAME" exit 1 + exit 1 fi - name: Verify target branch is correct milestone run: | diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index fc9bcdecd..b6a580b6b 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -6,6 +6,7 @@ on: jobs: build-release: + name: Release & Deletee branch runs-on: ubuntu-latest steps: @@ -32,17 +33,6 @@ jobs: git config user.name "GitHub Actions" git config user.email "actions@github.com" - - name: Check if milestone branch exists - id: check_branch - run: | - if git ls-remote --heads origin ${{ steps.milestone.outputs.milestone_branch }} | grep -q ${{ steps.milestone.outputs.milestone_branch }}; then - echo "exists=true" >> $GITHUB_OUTPUT - else - echo "exists=false" >> $GITHUB_OUTPUT - echo "No corresponding milestone branch found for ${{ steps.milestone.outputs.milestone_title }}, exiting." - exit 1 - fi - - name: Merge milestone into master if: steps.check_branch.outputs.exists == 'true' run: | @@ -98,3 +88,6 @@ jobs: files: release/OpenMC-${{ github.ref_name }}.jar env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Delete branch + run: git push origin --delete ${{ steps.milestone.outputs.milestone_branch }} diff --git a/.github/workflows/milestone-create.yml b/.github/workflows/milestone-create.yml new file mode 100644 index 000000000..ec884d257 --- /dev/null +++ b/.github/workflows/milestone-create.yml @@ -0,0 +1,25 @@ +name: Handle creating a milestone + +on: + milestone: + types: [created] + +jobs: + create-branch: + name: Create associated branch + runs-on: ubuntu-latest + steps: + # Just so that git is setup for us + - name: Checkout repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Create branch + run: | + # Convert milestone title to the corresponding branch name (same logic as in milestone-close.yml) + MILESTONE_TITLE="${{ github.event.milestone.title }}" + BRANCH_NAME=$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') + + git checkout -b $BRANCH_NAME + git push -u origin $BRANCH_NAME From d87e9cd58a7e6a1fd48c831d44d5143fa6c295b2 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Tue, 22 Apr 2025 08:48:50 +0200 Subject: [PATCH 25/81] fix: wrong branch name --- .github/workflows/milestone-create.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/milestone-create.yml b/.github/workflows/milestone-create.yml index ec884d257..c4dba941f 100644 --- a/.github/workflows/milestone-create.yml +++ b/.github/workflows/milestone-create.yml @@ -20,6 +20,7 @@ jobs: # Convert milestone title to the corresponding branch name (same logic as in milestone-close.yml) MILESTONE_TITLE="${{ github.event.milestone.title }}" BRANCH_NAME=$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') + MILESTONE_BRANCH=milestone-$BRANCH_NAME - git checkout -b $BRANCH_NAME - git push -u origin $BRANCH_NAME + git checkout -b $MILESTONE_BRANCH + git push -u origin $MILESTONE_BRANCH From f6f74ee90585a79c0081e04f7dcfb4412175e537 Mon Sep 17 00:00:00 2001 From: Piquel <63727792+PiquelChips@users.noreply.github.com> Date: Tue, 22 Apr 2025 08:51:29 +0200 Subject: [PATCH 26/81] Feat (#9) * remove pr-close workflow * feat: check if target branch is correct * fix typo * fix typo * clean check-milestone * feat: milestone-create workflow * feat: add deleting branch when milestone-closed * clean up milestone workflows * fix: wrong branch name --- .github/workflows/milestone-create.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/milestone-create.yml b/.github/workflows/milestone-create.yml index ec884d257..c4dba941f 100644 --- a/.github/workflows/milestone-create.yml +++ b/.github/workflows/milestone-create.yml @@ -20,6 +20,7 @@ jobs: # Convert milestone title to the corresponding branch name (same logic as in milestone-close.yml) MILESTONE_TITLE="${{ github.event.milestone.title }}" BRANCH_NAME=$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') + MILESTONE_BRANCH=milestone-$BRANCH_NAME - git checkout -b $BRANCH_NAME - git push -u origin $BRANCH_NAME + git checkout -b $MILESTONE_BRANCH + git push -u origin $MILESTONE_BRANCH From ca63894f026fd8b3ff8dbb642b6efcae598682d7 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Tue, 22 Apr 2025 09:00:49 +0200 Subject: [PATCH 27/81] fix: naming of jar in release workflow --- .github/workflows/milestone-close.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index b6a580b6b..78d2e34c7 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -66,12 +66,12 @@ jobs: - name: Build with Gradle run: ./gradlew shadowJar - name: Create release folder - run: mkdir -p release && mv builds/OpenMC.jar release/OpenMC-${GITHUB_REF#refs/tags/}.jar + run: mkdir -p release && mv builds/OpenMC.jar release/OpenMC-${{ steps.milestone.outputs.milestone_title }}.jar - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: OpenMC-${{ github.ref_name }} + name: OpenMC-${{ steps.milestone.outputs.milestone_title }} path: release/ - name: Create GitHub Release @@ -85,7 +85,7 @@ jobs: ${{ steps.milestone.outputs.milestone_description }} This release was automatically created when milestone "${{ steps.milestone.outputs.milestone_title }}" was closed. - files: release/OpenMC-${{ github.ref_name }}.jar + files: release/OpenMC-${{ steps.milestone.outputs.milestone_title }}.jar env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 71e3a0625be90984eb541dd4486d307fb5b3b268 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Tue, 22 Apr 2025 09:23:52 +0200 Subject: [PATCH 28/81] feat: clean pr template --- .github/pull_request_template.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 306f67488..78f409d1d 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,14 +1,17 @@ -## Pour que votre Pull Request soit accepté, il vous faut : -* Votre code suit-il le [Code de Conduite](https://github.com/ServerOpenMC/PluginV2/blob/master/CODE_OF_CONDUCT.md) ? : -* Avez-vous supprimé au maximum les imports non utilisés ? : -* Avez-vous commentez vos méthodes pour une meilleure lisibilité ? : -* Fournissez un Profileur (/spark profiler) lorsque vous éxécuter vos commandes, méthodes : - -* Les Issues corrigé(e)s/en commun : +## Petit résumé de la PR: ## Étape nécessaire afin que la PR soit fini (si PR en draft) -*mettez des checkbox `- []` et les cocher lorsque les taches sont finies* -*ex. - [] Enlever tous les imports non utilisé* +*mettez des checkbox `- [ ]` et les cocher lorsque les taches sont finies* + +- [ ] Suivre le [Code de Conduite](https://github.com/ServerOpenMC/PluginV2/blob/master/CODE_OF_CONDUCT.md) +- [ ] Enlever tous les imports non utilisé +- [ ] Bien documenté la feature +- [ ] Fourir un profileur (si besoin/demandé par un admin) +- [ ] Avoir une milestone associée à la PR +- [ ] Avoir pour branche cible, la branche de la milestone associée a la PR +- [ ] Validé tout les checks + +* Les Issues corrigé(e)s/en commun : ## Decrivez vos changements *Clairement et avec des screenshots si nécessaires* From 8e1c3f550688bb632ab28b35ef858320290ad4c0 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Tue, 22 Apr 2025 09:32:08 +0200 Subject: [PATCH 29/81] feat: workflows.md to explain the pipeline --- .github/workflows/workflows.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/workflows.md diff --git a/.github/workflows/workflows.md b/.github/workflows/workflows.md new file mode 100644 index 000000000..f99176131 --- /dev/null +++ b/.github/workflows/workflows.md @@ -0,0 +1,33 @@ +# Notre pipeline CI/CD + +## Qu'est-ce qu'une "pipeline CI/CD" + +Une pipeline CI/CD (Continuous Intergration/Continuous Deployment) est un système qui permet de +faciliter l'intégration des changements au repo (ici avec des build-test et unit-test) et le déploiment de la codebase. +Dans le cas de **OpenMC**, on créé une release avec un build du plugin. + +## Comment elle fonctionne + +La pipeline de **OpenMC** fonctionne autour du système de milestone de **Github**. +Lorsqu'une milestone est créé, une branch associée a celle-ci est créé. +Ainsi, lorsque des changements sont fait, il faut les faire sur la branch associée à la au milestone de l'issue ou de la PR. +Une fois que la milestone est terminée, elle seras fermée par un admin du repo. +Ceci mergeras la branche milestone dans **master** et créeras une release. + +## Pour les contributeurs + +Lorsque vous ferez vos PR, il vous faudra vérifier plusieurs choses (mais ne vous inquiétez pas, tout les dans le modêle de PR). +1. Attendez qu'un admin du repo associe votre PR a un milestone +2. Lorsque vous aurez un milestone, changez la branch cible de voutre PR vers la branche de la milestone associée a votre PR +3. Si tout a été fait correctement, les checks "**Milestone Checks**" seront validés + +## Pour les administrateurs du repo + +Ce système permet de relier la version du plugin à une milestone. +Il vous faudra donc nommer les milestone avec un nom de la forme "v2.1.3" (en semantic versining) afin de maintenir la cohérence du repo. +Ensuite, lorsque des PR sont créées, il faut impérativement associé un milestone a celle-ci, sinon les checks "**Milestone Checks**" ne reussiront pas (et le système de versionning aussi). +Il faut a tout prit **éviter de push directement dans `master`** et si sa vous arrive, il faudra synchroniser toute les branches milestone avec master. +Sinon, lors de la fermeture d'un milestone, il risque d'y avoir des conflits en mergeant avec master. + +Enfin, il vous faudra à chaque fermeture de milestone, synchroniser toute les branches milestone avec master (encore une fois pour éviter des conflits). +Cependant, je vais commencer a reflechir a un système qui ferait ça automatiquement. From f7e8484eedf869543ca383b42532516b2aab9b81 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Tue, 22 Apr 2025 09:00:49 +0200 Subject: [PATCH 30/81] fix: naming of jar in release workflow --- .github/workflows/milestone-close.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index b6a580b6b..78d2e34c7 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -66,12 +66,12 @@ jobs: - name: Build with Gradle run: ./gradlew shadowJar - name: Create release folder - run: mkdir -p release && mv builds/OpenMC.jar release/OpenMC-${GITHUB_REF#refs/tags/}.jar + run: mkdir -p release && mv builds/OpenMC.jar release/OpenMC-${{ steps.milestone.outputs.milestone_title }}.jar - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: OpenMC-${{ github.ref_name }} + name: OpenMC-${{ steps.milestone.outputs.milestone_title }} path: release/ - name: Create GitHub Release @@ -85,7 +85,7 @@ jobs: ${{ steps.milestone.outputs.milestone_description }} This release was automatically created when milestone "${{ steps.milestone.outputs.milestone_title }}" was closed. - files: release/OpenMC-${{ github.ref_name }}.jar + files: release/OpenMC-${{ steps.milestone.outputs.milestone_title }}.jar env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From bada03e4f2e7bf963bf7f508b04e3d71e77bd64a Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Tue, 22 Apr 2025 09:23:52 +0200 Subject: [PATCH 31/81] feat: clean pr template --- .github/pull_request_template.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 306f67488..78f409d1d 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,14 +1,17 @@ -## Pour que votre Pull Request soit accepté, il vous faut : -* Votre code suit-il le [Code de Conduite](https://github.com/ServerOpenMC/PluginV2/blob/master/CODE_OF_CONDUCT.md) ? : -* Avez-vous supprimé au maximum les imports non utilisés ? : -* Avez-vous commentez vos méthodes pour une meilleure lisibilité ? : -* Fournissez un Profileur (/spark profiler) lorsque vous éxécuter vos commandes, méthodes : - -* Les Issues corrigé(e)s/en commun : +## Petit résumé de la PR: ## Étape nécessaire afin que la PR soit fini (si PR en draft) -*mettez des checkbox `- []` et les cocher lorsque les taches sont finies* -*ex. - [] Enlever tous les imports non utilisé* +*mettez des checkbox `- [ ]` et les cocher lorsque les taches sont finies* + +- [ ] Suivre le [Code de Conduite](https://github.com/ServerOpenMC/PluginV2/blob/master/CODE_OF_CONDUCT.md) +- [ ] Enlever tous les imports non utilisé +- [ ] Bien documenté la feature +- [ ] Fourir un profileur (si besoin/demandé par un admin) +- [ ] Avoir une milestone associée à la PR +- [ ] Avoir pour branche cible, la branche de la milestone associée a la PR +- [ ] Validé tout les checks + +* Les Issues corrigé(e)s/en commun : ## Decrivez vos changements *Clairement et avec des screenshots si nécessaires* From 6115c5dad6bac0e21cbf40e8d77acb4c70937ce0 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Tue, 22 Apr 2025 09:32:08 +0200 Subject: [PATCH 32/81] feat: workflows.md to explain the pipeline --- .github/workflows/workflows.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/workflows.md diff --git a/.github/workflows/workflows.md b/.github/workflows/workflows.md new file mode 100644 index 000000000..f99176131 --- /dev/null +++ b/.github/workflows/workflows.md @@ -0,0 +1,33 @@ +# Notre pipeline CI/CD + +## Qu'est-ce qu'une "pipeline CI/CD" + +Une pipeline CI/CD (Continuous Intergration/Continuous Deployment) est un système qui permet de +faciliter l'intégration des changements au repo (ici avec des build-test et unit-test) et le déploiment de la codebase. +Dans le cas de **OpenMC**, on créé une release avec un build du plugin. + +## Comment elle fonctionne + +La pipeline de **OpenMC** fonctionne autour du système de milestone de **Github**. +Lorsqu'une milestone est créé, une branch associée a celle-ci est créé. +Ainsi, lorsque des changements sont fait, il faut les faire sur la branch associée à la au milestone de l'issue ou de la PR. +Une fois que la milestone est terminée, elle seras fermée par un admin du repo. +Ceci mergeras la branche milestone dans **master** et créeras une release. + +## Pour les contributeurs + +Lorsque vous ferez vos PR, il vous faudra vérifier plusieurs choses (mais ne vous inquiétez pas, tout les dans le modêle de PR). +1. Attendez qu'un admin du repo associe votre PR a un milestone +2. Lorsque vous aurez un milestone, changez la branch cible de voutre PR vers la branche de la milestone associée a votre PR +3. Si tout a été fait correctement, les checks "**Milestone Checks**" seront validés + +## Pour les administrateurs du repo + +Ce système permet de relier la version du plugin à une milestone. +Il vous faudra donc nommer les milestone avec un nom de la forme "v2.1.3" (en semantic versining) afin de maintenir la cohérence du repo. +Ensuite, lorsque des PR sont créées, il faut impérativement associé un milestone a celle-ci, sinon les checks "**Milestone Checks**" ne reussiront pas (et le système de versionning aussi). +Il faut a tout prit **éviter de push directement dans `master`** et si sa vous arrive, il faudra synchroniser toute les branches milestone avec master. +Sinon, lors de la fermeture d'un milestone, il risque d'y avoir des conflits en mergeant avec master. + +Enfin, il vous faudra à chaque fermeture de milestone, synchroniser toute les branches milestone avec master (encore une fois pour éviter des conflits). +Cependant, je vais commencer a reflechir a un système qui ferait ça automatiquement. From 7b9ced3200f5fff8a0e0fc7205bf55a3f4395df8 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Tue, 22 Apr 2025 09:36:29 +0200 Subject: [PATCH 33/81] fix: check-milestone had suplicated code --- .github/workflows/check-milestone.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/check-milestone.yml b/.github/workflows/check-milestone.yml index d1e545f38..627ae93fe 100644 --- a/.github/workflows/check-milestone.yml +++ b/.github/workflows/check-milestone.yml @@ -24,17 +24,6 @@ jobs: MILESTONE_TITLE="${{ github.event.pull_request.milestone.title }}" BRANCH_NAME=milestone-$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') if [ "${{ github.event.pull_request.base.ref }}" != "$BRANCH_NAME" ]; then - echo "❌ Target branch is not Milestone branch. It should be $BRANCH_NAME" exit 1 - exit 1 - fi - - name: Verify target branch is correct milestone - run: | - MILESTONE_TITLE="${{ github.event.pull_request.milestone.title }}" - BRANCH_NAME=milestone-$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') - if [ "${{ github.event.pull_request.base.ref }}" == "$BRANCH_NAME" ]; then - echo "✅ Target branch is correct milestone branch" - else echo "❌ Target branch is not Milestone branch. It should be $BRANCH_NAME" exit 1 fi - From 7104f09a942c1cb4e64d56a3c908cb5fa19b48b2 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Tue, 22 Apr 2025 09:37:35 +0200 Subject: [PATCH 34/81] remove test --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index f2219b9ef..45ab6004b 100644 --- a/README.md +++ b/README.md @@ -24,5 +24,3 @@ Projet sous [GPL-3.0 license](https://choosealicense.com/licenses/gpl-3.0/). --- Merci à @MathiasDPX pour la nouvelle configuration du repo. - -juste un test From 93a538491a7259aa22db8022f438783e0fa0bd4c Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Tue, 22 Apr 2025 17:19:53 +0200 Subject: [PATCH 35/81] feat: simplified pipeline --- .github/workflows/check-milestone.yml | 27 +----------- .github/workflows/milestone-close.yml | 59 +++++--------------------- .github/workflows/milestone-create.yml | 26 ------------ .github/workflows/workflows.md | 33 -------------- 4 files changed, 13 insertions(+), 132 deletions(-) delete mode 100644 .github/workflows/milestone-create.yml delete mode 100644 .github/workflows/workflows.md diff --git a/.github/workflows/check-milestone.yml b/.github/workflows/check-milestone.yml index d1e545f38..da6375eb8 100644 --- a/.github/workflows/check-milestone.yml +++ b/.github/workflows/check-milestone.yml @@ -1,4 +1,4 @@ -name: Milestone Checks +name: Milestone Check on: pull_request: @@ -6,7 +6,7 @@ on: jobs: check-milestone: - name: Does PR have a milestone + name: Milestone check runs-on: ubuntu-latest steps: - name: Verify that PR has been assigned a milestone @@ -15,26 +15,3 @@ jobs: echo "❌ PR has not been assigned a milestone." exit 1 fi - check-target: - name: Is target branch the milestone branch - runs-on: ubuntu-latest - steps: - - name: Verify target branch is correct milestone - run: | - MILESTONE_TITLE="${{ github.event.pull_request.milestone.title }}" - BRANCH_NAME=milestone-$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') - if [ "${{ github.event.pull_request.base.ref }}" != "$BRANCH_NAME" ]; then - echo "❌ Target branch is not Milestone branch. It should be $BRANCH_NAME" exit 1 - exit 1 - fi - - name: Verify target branch is correct milestone - run: | - MILESTONE_TITLE="${{ github.event.pull_request.milestone.title }}" - BRANCH_NAME=milestone-$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') - if [ "${{ github.event.pull_request.base.ref }}" == "$BRANCH_NAME" ]; then - echo "✅ Target branch is correct milestone branch" - else - echo "❌ Target branch is not Milestone branch. It should be $BRANCH_NAME" - exit 1 - fi - diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 78d2e34c7..dbdde44dd 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -6,9 +6,8 @@ on: jobs: build-release: - name: Release & Deletee branch + name: Release runs-on: ubuntu-latest - steps: - name: Checkout repository uses: actions/checkout@v4 @@ -16,44 +15,11 @@ jobs: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} - # Merge milestone branch into master - - - name: Get milestone information - id: milestone - run: | - # Convert milestone title to the corresponding branch name (same logic as in pr-close.yml) - MILESTONE_TITLE="${{ github.event.milestone.title }}" - BRANCH_NAME=$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') - echo "milestone_branch=milestone-${BRANCH_NAME}" >> $GITHUB_OUTPUT - echo "milestone_title=$MILESTONE_TITLE" >> $GITHUB_OUTPUT - echo "milestone_description=${{ github.event.milestone.description }}" >> $GITHUB_OUTPUT - - - name: Configure Git - run: | - git config user.name "GitHub Actions" - git config user.email "actions@github.com" - - - name: Merge milestone into master - if: steps.check_branch.outputs.exists == 'true' - run: | - git checkout master - git pull origin master - - # Merge milestone branch into master - git merge --no-ff origin/${{ steps.milestone.outputs.milestone_branch }} -m "Merge milestone branch ${{ steps.milestone.outputs.milestone_branch }} into master upon milestone closure" - - git push origin master - echo "Merged milestone branch ${{ steps.milestone.outputs.milestone_branch }} into master" - - # Build the plugin and release it - - name: Create release tag - id: tag run: | - TAG_NAME="${{ steps.milestone.outputs.milestone_title }}" - git tag -a $TAG_NAME -m "Release ${{ steps.milestone.outputs.milestone_title }}" + TAG_NAME="${{ github.event.milestone.title }}" + git tag -a $TAG_NAME -m "Release ${{ github.event.milestone.title }}" git push origin $TAG_NAME - echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT - name: Set up JDK 21 uses: actions/setup-java@v4 @@ -66,28 +32,25 @@ jobs: - name: Build with Gradle run: ./gradlew shadowJar - name: Create release folder - run: mkdir -p release && mv builds/OpenMC.jar release/OpenMC-${{ steps.milestone.outputs.milestone_title }}.jar + run: mkdir -p release && mv builds/OpenMC.jar release/OpenMC-${{ github.event.milestone.title }}.jar - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: OpenMC-${{ steps.milestone.outputs.milestone_title }} + name: OpenMC-${{ github.event.milestone.title }} path: release/ - name: Create GitHub Release uses: softprops/action-gh-release@v2 with: - tag_name: ${{ steps.tag.outputs.tag_name }} - name: Release ${{ steps.milestone.outputs.milestone_title }} + tag_name: ${{ github.event.milestone.title }} + name: Release ${{ github.event.milestone.title }} body: | - # Release ${{ steps.milestone.outputs.milestone_title }} + # Release ${{ github.event.milestone.title }} - ${{ steps.milestone.outputs.milestone_description }} + ${{ github.event.milestone.description }} - This release was automatically created when milestone "${{ steps.milestone.outputs.milestone_title }}" was closed. - files: release/OpenMC-${{ steps.milestone.outputs.milestone_title }}.jar + This release was automatically created when milestone "${{ github.event.milestone.title }}" was closed. + files: release/OpenMC-${{ github.event.milestone.title }}.jar env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Delete branch - run: git push origin --delete ${{ steps.milestone.outputs.milestone_branch }} diff --git a/.github/workflows/milestone-create.yml b/.github/workflows/milestone-create.yml deleted file mode 100644 index c4dba941f..000000000 --- a/.github/workflows/milestone-create.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Handle creating a milestone - -on: - milestone: - types: [created] - -jobs: - create-branch: - name: Create associated branch - runs-on: ubuntu-latest - steps: - # Just so that git is setup for us - - name: Checkout repository - uses: actions/checkout@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Create branch - run: | - # Convert milestone title to the corresponding branch name (same logic as in milestone-close.yml) - MILESTONE_TITLE="${{ github.event.milestone.title }}" - BRANCH_NAME=$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') - MILESTONE_BRANCH=milestone-$BRANCH_NAME - - git checkout -b $MILESTONE_BRANCH - git push -u origin $MILESTONE_BRANCH diff --git a/.github/workflows/workflows.md b/.github/workflows/workflows.md deleted file mode 100644 index f99176131..000000000 --- a/.github/workflows/workflows.md +++ /dev/null @@ -1,33 +0,0 @@ -# Notre pipeline CI/CD - -## Qu'est-ce qu'une "pipeline CI/CD" - -Une pipeline CI/CD (Continuous Intergration/Continuous Deployment) est un système qui permet de -faciliter l'intégration des changements au repo (ici avec des build-test et unit-test) et le déploiment de la codebase. -Dans le cas de **OpenMC**, on créé une release avec un build du plugin. - -## Comment elle fonctionne - -La pipeline de **OpenMC** fonctionne autour du système de milestone de **Github**. -Lorsqu'une milestone est créé, une branch associée a celle-ci est créé. -Ainsi, lorsque des changements sont fait, il faut les faire sur la branch associée à la au milestone de l'issue ou de la PR. -Une fois que la milestone est terminée, elle seras fermée par un admin du repo. -Ceci mergeras la branche milestone dans **master** et créeras une release. - -## Pour les contributeurs - -Lorsque vous ferez vos PR, il vous faudra vérifier plusieurs choses (mais ne vous inquiétez pas, tout les dans le modêle de PR). -1. Attendez qu'un admin du repo associe votre PR a un milestone -2. Lorsque vous aurez un milestone, changez la branch cible de voutre PR vers la branche de la milestone associée a votre PR -3. Si tout a été fait correctement, les checks "**Milestone Checks**" seront validés - -## Pour les administrateurs du repo - -Ce système permet de relier la version du plugin à une milestone. -Il vous faudra donc nommer les milestone avec un nom de la forme "v2.1.3" (en semantic versining) afin de maintenir la cohérence du repo. -Ensuite, lorsque des PR sont créées, il faut impérativement associé un milestone a celle-ci, sinon les checks "**Milestone Checks**" ne reussiront pas (et le système de versionning aussi). -Il faut a tout prit **éviter de push directement dans `master`** et si sa vous arrive, il faudra synchroniser toute les branches milestone avec master. -Sinon, lors de la fermeture d'un milestone, il risque d'y avoir des conflits en mergeant avec master. - -Enfin, il vous faudra à chaque fermeture de milestone, synchroniser toute les branches milestone avec master (encore une fois pour éviter des conflits). -Cependant, je vais commencer a reflechir a un système qui ferait ça automatiquement. From 22b28607c0e6d484e514cc5388e263b695e4e172 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 14:37:50 +0200 Subject: [PATCH 36/81] fix typos (I hope) --- .github/pull_request_template.md | 12 ++++++------ .github/workflows/workflows.md | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index a98ea3da2..cdf64dcd5 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -2,17 +2,17 @@ ## Étape nécessaire afin que la PR soit fini (si PR en draft) - + - [ ] Suivre le [Code de Conduite](https://github.com/ServerOpenMC/PluginV2/blob/master/CODE_OF_CONDUCT.md) -- [ ] Enlever tous les imports non utilisé -- [ ] Bien documenté la feature -- [ ] Fourir un profileur (si besoin/demandé par un admin) +- [ ] Enlever tous les imports non utilisés +- [ ] Bien documenter la feature +- [ ] Fournir un profileur (si besoin/demandé par un admin) - [ ] Avoir une milestone associée à la PR - [ ] Avoir pour branche cible, la branche de la milestone associée a la PR -- [ ] Validé tout les checks +- [ ] Valider tout les checks -* Les Issues corrigé(e)s/en commun : +* Les Issues corrigée(s) en commun : ## Decrivez vos changements diff --git a/.github/workflows/workflows.md b/.github/workflows/workflows.md index f99176131..57a14059d 100644 --- a/.github/workflows/workflows.md +++ b/.github/workflows/workflows.md @@ -8,26 +8,26 @@ Dans le cas de **OpenMC**, on créé une release avec un build du plugin. ## Comment elle fonctionne -La pipeline de **OpenMC** fonctionne autour du système de milestone de **Github**. +La pipeline de **OpenMC** fonctionne autour du système de milestones de **Github**. Lorsqu'une milestone est créé, une branch associée a celle-ci est créé. -Ainsi, lorsque des changements sont fait, il faut les faire sur la branch associée à la au milestone de l'issue ou de la PR. +Ainsi, lorsque des changements sont fait, il faut les faire sur la branch associée à la milestone de l'issue ou de la PR. Une fois que la milestone est terminée, elle seras fermée par un admin du repo. -Ceci mergeras la branche milestone dans **master** et créeras une release. +Ceci mergeras la branche milestone dans **master** et créera une release. ## Pour les contributeurs Lorsque vous ferez vos PR, il vous faudra vérifier plusieurs choses (mais ne vous inquiétez pas, tout les dans le modêle de PR). -1. Attendez qu'un admin du repo associe votre PR a un milestone -2. Lorsque vous aurez un milestone, changez la branch cible de voutre PR vers la branche de la milestone associée a votre PR +1. Attendez qu'un admin du repo associe votre PR a une milestone +2. Lorsque vous aurez une milestone, changez la branch cible de voutre PR vers la branche de la milestone associée a votre PR 3. Si tout a été fait correctement, les checks "**Milestone Checks**" seront validés ## Pour les administrateurs du repo Ce système permet de relier la version du plugin à une milestone. -Il vous faudra donc nommer les milestone avec un nom de la forme "v2.1.3" (en semantic versining) afin de maintenir la cohérence du repo. -Ensuite, lorsque des PR sont créées, il faut impérativement associé un milestone a celle-ci, sinon les checks "**Milestone Checks**" ne reussiront pas (et le système de versionning aussi). -Il faut a tout prit **éviter de push directement dans `master`** et si sa vous arrive, il faudra synchroniser toute les branches milestone avec master. -Sinon, lors de la fermeture d'un milestone, il risque d'y avoir des conflits en mergeant avec master. +Il vous faudra donc nommer les milestones avec un nom de la forme "v2.1.3" (en semantic versining) afin de maintenir la cohérence du repo. +Ensuite, lorsque des PR sont créées, il faut impérativement associer une milestone a celle-ci, sinon les checks "**Milestone Checks**" ne reussiront pas (et le système de versionning aussi). +Il faut a tout prix **éviter de push directement dans `master`** et si sa vous arrive, il faudra synchroniser toute les branches milestone avec master. +Sinon, lors de la fermeture d'une milestone, il risque d'y avoir des conflits en mergeant avec master. -Enfin, il vous faudra à chaque fermeture de milestone, synchroniser toute les branches milestone avec master (encore une fois pour éviter des conflits). +Enfin, il vous faudra à chaque fermeture de milestone, synchroniser toutes les branches milestone avec master (encore une fois pour éviter des conflits). Cependant, je vais commencer a reflechir a un système qui ferait ça automatiquement. From c62603bf8152194af0698014a65db854d21b07ed Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 15:25:47 +0200 Subject: [PATCH 37/81] feat: add automatic release notes generation --- .github/release.yml | 14 ++++++++++++++ .github/workflows/milestone-close.yml | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .github/release.yml diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 000000000..6f4827a8b --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,14 @@ +changelog: + categories: + - title: Nouvelles features + labels: + - "🆙 Amélioration" + - ":arrows_counterclockwise: Changement" + - ":package: Features" + - title: Bugs et Optimisations + labels: + - "⚡Optimisation" + - ":sparkles: Fixes" + - title: Autre + labels: + - "*" diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 78d2e34c7..21d552675 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -79,8 +79,9 @@ jobs: with: tag_name: ${{ steps.tag.outputs.tag_name }} name: Release ${{ steps.milestone.outputs.milestone_title }} + generate_release_notes: true body: | - # Release ${{ steps.milestone.outputs.milestone_title }} + # Release milestone ${{ steps.milestone.outputs.milestone_title }} ${{ steps.milestone.outputs.milestone_description }} From 04236f0584a9b1cfafc80b3ca94893de03cb26d7 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 15:35:17 +0200 Subject: [PATCH 38/81] translated release.yml --- .github/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/release.yml b/.github/release.yml index 6f4827a8b..1bcf4179e 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,14 +1,14 @@ changelog: categories: - - title: Nouvelles features + - title: New Features labels: - "🆙 Amélioration" - ":arrows_counterclockwise: Changement" - ":package: Features" - - title: Bugs et Optimisations + - title: Bugs and Optimizations labels: - "⚡Optimisation" - ":sparkles: Fixes" - - title: Autre + - title: Other labels: - "*" From dd3134251e0e233bd14d45abfa3828d8c3942a1b Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 15:36:36 +0200 Subject: [PATCH 39/81] remove unnecessary step in PR template --- .github/pull_request_template.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 78f409d1d..c02d6c597 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -8,7 +8,6 @@ - [ ] Bien documenté la feature - [ ] Fourir un profileur (si besoin/demandé par un admin) - [ ] Avoir une milestone associée à la PR -- [ ] Avoir pour branche cible, la branche de la milestone associée a la PR - [ ] Validé tout les checks * Les Issues corrigé(e)s/en commun : From 4bf75941ea7dbff7630026a16ca6d7328139dbe7 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:00:42 +0200 Subject: [PATCH 40/81] fix: version numbre not being set properly in plugin.yml --- build.gradle | 2 +- src/test/resources/plugin.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 6c633ea08..d53bb59a5 100644 --- a/build.gradle +++ b/build.gradle @@ -81,7 +81,7 @@ processResources { def props = ["version": version] inputs.properties(props) filteringCharset = 'UTF-8' - filesMatching('paper-plugin.yml') { + filesMatching('plugin.yml') { expand(props) } } diff --git a/src/test/resources/plugin.yml b/src/test/resources/plugin.yml index aa03d073b..3ec76e790 100644 --- a/src/test/resources/plugin.yml +++ b/src/test/resources/plugin.yml @@ -1,5 +1,5 @@ name: OpenMC -version: '2.0.0' +version: ${version} main: fr.openmc.core.TestPlugin api-version: '1.21.4' -prefix: OMC \ No newline at end of file +prefix: OMC From 4d2d8f2847b5a86f7a2779840420f69d4b21b405 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:04:00 +0200 Subject: [PATCH 41/81] feat: removed unneccessary workflows --- .github/workflows/milestone-create.yml | 26 -------------------- .github/workflows/workflows.md | 33 -------------------------- 2 files changed, 59 deletions(-) delete mode 100644 .github/workflows/milestone-create.yml delete mode 100644 .github/workflows/workflows.md diff --git a/.github/workflows/milestone-create.yml b/.github/workflows/milestone-create.yml deleted file mode 100644 index c4dba941f..000000000 --- a/.github/workflows/milestone-create.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Handle creating a milestone - -on: - milestone: - types: [created] - -jobs: - create-branch: - name: Create associated branch - runs-on: ubuntu-latest - steps: - # Just so that git is setup for us - - name: Checkout repository - uses: actions/checkout@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Create branch - run: | - # Convert milestone title to the corresponding branch name (same logic as in milestone-close.yml) - MILESTONE_TITLE="${{ github.event.milestone.title }}" - BRANCH_NAME=$(echo "$MILESTONE_TITLE" | tr ' ' '-' | tr -cd '[:alnum:]-') - MILESTONE_BRANCH=milestone-$BRANCH_NAME - - git checkout -b $MILESTONE_BRANCH - git push -u origin $MILESTONE_BRANCH diff --git a/.github/workflows/workflows.md b/.github/workflows/workflows.md deleted file mode 100644 index 57a14059d..000000000 --- a/.github/workflows/workflows.md +++ /dev/null @@ -1,33 +0,0 @@ -# Notre pipeline CI/CD - -## Qu'est-ce qu'une "pipeline CI/CD" - -Une pipeline CI/CD (Continuous Intergration/Continuous Deployment) est un système qui permet de -faciliter l'intégration des changements au repo (ici avec des build-test et unit-test) et le déploiment de la codebase. -Dans le cas de **OpenMC**, on créé une release avec un build du plugin. - -## Comment elle fonctionne - -La pipeline de **OpenMC** fonctionne autour du système de milestones de **Github**. -Lorsqu'une milestone est créé, une branch associée a celle-ci est créé. -Ainsi, lorsque des changements sont fait, il faut les faire sur la branch associée à la milestone de l'issue ou de la PR. -Une fois que la milestone est terminée, elle seras fermée par un admin du repo. -Ceci mergeras la branche milestone dans **master** et créera une release. - -## Pour les contributeurs - -Lorsque vous ferez vos PR, il vous faudra vérifier plusieurs choses (mais ne vous inquiétez pas, tout les dans le modêle de PR). -1. Attendez qu'un admin du repo associe votre PR a une milestone -2. Lorsque vous aurez une milestone, changez la branch cible de voutre PR vers la branche de la milestone associée a votre PR -3. Si tout a été fait correctement, les checks "**Milestone Checks**" seront validés - -## Pour les administrateurs du repo - -Ce système permet de relier la version du plugin à une milestone. -Il vous faudra donc nommer les milestones avec un nom de la forme "v2.1.3" (en semantic versining) afin de maintenir la cohérence du repo. -Ensuite, lorsque des PR sont créées, il faut impérativement associer une milestone a celle-ci, sinon les checks "**Milestone Checks**" ne reussiront pas (et le système de versionning aussi). -Il faut a tout prix **éviter de push directement dans `master`** et si sa vous arrive, il faudra synchroniser toute les branches milestone avec master. -Sinon, lors de la fermeture d'une milestone, il risque d'y avoir des conflits en mergeant avec master. - -Enfin, il vous faudra à chaque fermeture de milestone, synchroniser toutes les branches milestone avec master (encore une fois pour éviter des conflits). -Cependant, je vais commencer a reflechir a un système qui ferait ça automatiquement. From 379704bc84aae3c83d90da8b4d8d668381539266 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:15:14 +0200 Subject: [PATCH 42/81] feat: release posted on discord --- .github/workflows/release-to-discord.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/release-to-discord.yml diff --git a/.github/workflows/release-to-discord.yml b/.github/workflows/release-to-discord.yml new file mode 100644 index 000000000..a1eb1d0c0 --- /dev/null +++ b/.github/workflows/release-to-discord.yml @@ -0,0 +1,23 @@ +on: + release: + types: [published] + +jobs: + github-releases-to-discord: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Github Releases To Discord + uses: SethCohen/github-releases-to-discord@v1 + with: + webhook_url: ${{ secrets.WEBHOOK_URL }} + color: "2105893" + username: "OpenMC Update" + avatar_url: "https://cdn.discordapp.com/avatars/487431320314576937/bd64361e4ba6313d561d54e78c9e7171.png" + content: "||@everyone||" + footer_title: "Changelog" + footer_icon_url: "https://cdn.discordapp.com/avatars/487431320314576937/bd64361e4ba6313d561d54e78c9e7171.png" + footer_timestamp: true + max_description: '16384' + reduce_headings: true From 095d9073ebbbe32e0fbba0d0af5a5c4f0559ae94 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:24:51 +0200 Subject: [PATCH 43/81] fix checkout version for discord notif --- .github/workflows/release-to-discord.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-to-discord.yml b/.github/workflows/release-to-discord.yml index a1eb1d0c0..48118ac48 100644 --- a/.github/workflows/release-to-discord.yml +++ b/.github/workflows/release-to-discord.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v3 - name: Github Releases To Discord uses: SethCohen/github-releases-to-discord@v1 with: From bf834ca69678891b7a4befde4cce7dc693152e67 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:30:05 +0200 Subject: [PATCH 44/81] change actions version --- .github/workflows/release-to-discord.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-to-discord.yml b/.github/workflows/release-to-discord.yml index 48118ac48..e4fdc0955 100644 --- a/.github/workflows/release-to-discord.yml +++ b/.github/workflows/release-to-discord.yml @@ -7,9 +7,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Github Releases To Discord - uses: SethCohen/github-releases-to-discord@v1 + uses: SethCohen/github-releases-to-discord@v1.16.2 with: webhook_url: ${{ secrets.WEBHOOK_URL }} color: "2105893" From 5fc254f5af4e2bd5b61537e3ec67827241e5c4b1 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:38:06 +0200 Subject: [PATCH 45/81] fix: change @ in discord notification --- .github/workflows/release-to-discord.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-to-discord.yml b/.github/workflows/release-to-discord.yml index e4fdc0955..c3dc79a89 100644 --- a/.github/workflows/release-to-discord.yml +++ b/.github/workflows/release-to-discord.yml @@ -15,7 +15,7 @@ jobs: color: "2105893" username: "OpenMC Update" avatar_url: "https://cdn.discordapp.com/avatars/487431320314576937/bd64361e4ba6313d561d54e78c9e7171.png" - content: "||@everyone||" + content: "||@• Notifs OpenMC||" footer_title: "Changelog" footer_icon_url: "https://cdn.discordapp.com/avatars/487431320314576937/bd64361e4ba6313d561d54e78c9e7171.png" footer_timestamp: true From abe39f8f7f137910940d2db560176f0ac1fdadf5 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:58:02 +0200 Subject: [PATCH 46/81] simplify workflows --- .github/workflows/build-test.yml | 2 +- .github/workflows/milestone-close.yml | 8 +++----- .github/workflows/release-to-discord.yml | 2 ++ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index e85a77d60..1ba3fd9b9 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -72,4 +72,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: OpenMC-${{ github.sha }} - path: builds/OpenMC-*.jar + path: builds/ diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 49ed4254d..b38e5c443 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -30,15 +30,13 @@ jobs: - name: Make gradlew executable run: chmod +x ./gradlew - name: Build with Gradle - run: ./gradlew shadowJar - - name: Create release folder - run: mkdir -p release && mv builds/OpenMC.jar release/OpenMC-${{ steps.milestone.outputs.milestone_title }}.jar + run: ./gradlew jar - name: Upload artifact uses: actions/upload-artifact@v4 with: name: OpenMC-${{ steps.milestone.outputs.milestone_title }} - path: release/ + path: builds/ - name: Create GitHub Release uses: softprops/action-gh-release@v2 @@ -52,6 +50,6 @@ jobs: ${{ github.event.milestone.description }} This release was automatically created when milestone "${{ steps.milestone.outputs.milestone_title }}" was closed. - files: release/OpenMC-${{ steps.milestone.outputs.milestone_title }}.jar + files: builds/ env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-to-discord.yml b/.github/workflows/release-to-discord.yml index c3dc79a89..2f853137b 100644 --- a/.github/workflows/release-to-discord.yml +++ b/.github/workflows/release-to-discord.yml @@ -1,3 +1,4 @@ +name: Release to Discord on: release: types: [published] @@ -5,6 +6,7 @@ on: jobs: github-releases-to-discord: runs-on: ubuntu-latest + name: Release to Discord steps: - name: Checkout uses: actions/checkout@v4 From 0f35c95eb73bd5bffaaf6d8ad9e8307ab50611e7 Mon Sep 17 00:00:00 2001 From: Piquel <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 18:01:03 +0300 Subject: [PATCH 47/81] Feat (#14) * fix: List.of() creates immutable list * fix: Rename invitation variable to avoid confusion * feat: _iambibi's work from https://github.com/ServerOpenMC/PluginV2VersioningTest * Update README.md * feat: fix creation of tag * Update README.md * Update README.md * remove adding tags on merge * feat: add merging of milestone branch into master on milestone close * feat: combined all build and test workflows * fix: clean up workflows and translate * feat: merge PR into milestone branch * Plus de tests * Update README.md (#5) * remove pr-close workflow * feat: check if target branch is correct * fix typo * fix typo * Feat (#7) * remove pr-close workflow * feat: check if target branch is correct * fix typo * fix typo * clean check-milestone * feat: milestone-create workflow * feat: add deleting branch when milestone-closed * clean up milestone workflows * Feat (#8) * remove pr-close workflow * feat: check if target branch is correct * fix typo * fix typo * clean check-milestone * feat: milestone-create workflow * feat: add deleting branch when milestone-closed * clean up milestone workflows * fix: wrong branch name * Feat (#9) * remove pr-close workflow * feat: check if target branch is correct * fix typo * fix typo * clean check-milestone * feat: milestone-create workflow * feat: add deleting branch when milestone-closed * clean up milestone workflows * fix: wrong branch name * fix: naming of jar in release workflow * feat: clean pr template * feat: workflows.md to explain the pipeline * fix: naming of jar in release workflow * feat: clean pr template * feat: workflows.md to explain the pipeline * fix: check-milestone had suplicated code * remove test * feat: simplified pipeline * fix typos (I hope) * feat: add automatic release notes generation * translated release.yml * remove unnecessary step in PR template * fix: version numbre not being set properly in plugin.yml * feat: removed unneccessary workflows * feat: release posted on discord * fix checkout version for discord notif * change actions version * fix: change @ in discord notification * simplify workflows --------- Co-authored-by: GitHub Actions --- .github/pull_request_template.md | 19 ++-- .github/release.yml | 14 +++ .github/workflows/build-test.yml | 75 +++++++++++++ .github/workflows/check-milestone.yml | 17 +++ .github/workflows/main.yml | 48 --------- .github/workflows/milestone-close.yml | 55 ++++++++++ .github/workflows/release-to-discord.yml | 25 +++++ .github/workflows/tests.yml | 35 ------ build.gradle | 132 +++++++++++++---------- src/main/resources/plugin.yml | 2 +- src/test/resources/plugin.yml | 4 +- 11 files changed, 273 insertions(+), 153 deletions(-) create mode 100644 .github/release.yml create mode 100644 .github/workflows/build-test.yml create mode 100644 .github/workflows/check-milestone.yml delete mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/milestone-close.yml create mode 100644 .github/workflows/release-to-discord.yml delete mode 100644 .github/workflows/tests.yml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 5c6e869e0..90d88a6f6 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,14 +1,17 @@ -## Pour que votre Pull Request soit accepté, il vous faut : -* Votre code suit-il le [Code de Conduite](https://github.com/ServerOpenMC/PluginV2/blob/master/CODE_OF_CONDUCT.md) ? : -* Avez-vous supprimé au maximum les imports non utilisés ? : -* Avez-vous commentez vos méthodes pour une meilleure lisibilité ? : -* Fournissez un Profileur (/spark profiler) lorsque vous éxécuter vos commandes, méthodes : - -* Les Issues corrigé(e)s/en commun : +## Petit résumé de la PR: ## Étape nécessaire afin que la PR soit fini (si PR en draft) - + + +- [ ] Suivre le [Code de Conduite](https://github.com/ServerOpenMC/PluginV2/blob/master/CODE_OF_CONDUCT.md) +- [ ] Enlever tous les imports non utilisés +- [ ] Bien documenter la feature +- [ ] Fournir un profileur (si besoin/demandé par un admin) +- [ ] Avoir une milestone associée à la PR +- [ ] Valider tout les checks + +* Les Issues corrigée(s) en commun : ## Decrivez vos changements diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 000000000..1bcf4179e --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,14 @@ +changelog: + categories: + - title: New Features + labels: + - "🆙 Amélioration" + - ":arrows_counterclockwise: Changement" + - ":package: Features" + - title: Bugs and Optimizations + labels: + - "⚡Optimisation" + - ":sparkles: Fixes" + - title: Other + labels: + - "*" diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 000000000..1ba3fd9b9 --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,75 @@ +name: Build & Test + +on: + pull_request: + paths-ignore: + - '.github/**' + - '.gitignore' + - 'LICENSE' + - 'README.md' + push: + paths-ignore: + - '.github/**' + - '.gitignore' + - 'LICENSE' + - 'README.md' + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Run Tests with Gradle + run: ./gradlew test + + - name: Report test results + uses: dorny/test-reporter@v2 + if: always() + with: + name: Gradle Tests + path: build/test-results/test/*.xml + reporter: java-junit + fail-on-error: true + + build: + name: Build + runs-on: ubuntu-latest + permissions: write-all + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Build with snapshot version + env: + SNAPSHOT: true + GITHUB_SHA: ${{ github.sha }} + run: ./gradlew jar + + - name: Upload Plugin jar + uses: actions/upload-artifact@v4 + with: + name: OpenMC-${{ github.sha }} + path: builds/ diff --git a/.github/workflows/check-milestone.yml b/.github/workflows/check-milestone.yml new file mode 100644 index 000000000..da6375eb8 --- /dev/null +++ b/.github/workflows/check-milestone.yml @@ -0,0 +1,17 @@ +name: Milestone Check + +on: + pull_request: + types: [opened, edited, reopened, synchronize] + +jobs: + check-milestone: + name: Milestone check + runs-on: ubuntu-latest + steps: + - name: Verify that PR has been assigned a milestone + run: | + if [ "${{ github.event.pull_request.milestone }}" == "" ]; then + echo "❌ PR has not been assigned a milestone." + exit 1 + fi diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index ea33a588c..000000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Build DEV Jars - -on: - pull_request: - paths-ignore: - - '.github/PULL_REQUEST_TEMPLATE.md' - - '.gitignore' - - 'LICENSE' - - 'CODE_OF_CONDUCT.md' - - 'CONTRIBUTING.md' - - 'README.md' - push: - paths-ignore: - - '.github/PULL_REQUEST_TEMPLATE.md' - - '.gitignore' - - 'LICENSE' - - 'CODE_OF_CONDUCT.md' - - 'CONTRIBUTING.md' - - 'README.md' - -jobs: - build_dev_jars: - name: Build DEV jars - 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 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 - - 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 diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml new file mode 100644 index 000000000..b38e5c443 --- /dev/null +++ b/.github/workflows/milestone-close.yml @@ -0,0 +1,55 @@ +name: Handle closing a milestone + +on: + milestone: + types: [closed] + +jobs: + build-release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Create release tag + run: | + TAG_NAME="${{ github.event.milestone.title }}" + git tag -a $TAG_NAME -m "Release ${{ github.event.milestone.title }}" + git push origin $TAG_NAME + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + + - name: Make gradlew executable + run: chmod +x ./gradlew + - name: Build with Gradle + run: ./gradlew jar + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: OpenMC-${{ steps.milestone.outputs.milestone_title }} + path: builds/ + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.tag.outputs.tag_name }} + name: Release ${{ steps.milestone.outputs.milestone_title }} + generate_release_notes: true + body: | + # Release milestone ${{ steps.milestone.outputs.milestone_title }} + + ${{ github.event.milestone.description }} + + This release was automatically created when milestone "${{ steps.milestone.outputs.milestone_title }}" was closed. + files: builds/ + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-to-discord.yml b/.github/workflows/release-to-discord.yml new file mode 100644 index 000000000..2f853137b --- /dev/null +++ b/.github/workflows/release-to-discord.yml @@ -0,0 +1,25 @@ +name: Release to Discord +on: + release: + types: [published] + +jobs: + github-releases-to-discord: + runs-on: ubuntu-latest + name: Release to Discord + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Github Releases To Discord + uses: SethCohen/github-releases-to-discord@v1.16.2 + with: + webhook_url: ${{ secrets.WEBHOOK_URL }} + color: "2105893" + username: "OpenMC Update" + avatar_url: "https://cdn.discordapp.com/avatars/487431320314576937/bd64361e4ba6313d561d54e78c9e7171.png" + content: "||@• Notifs OpenMC||" + footer_title: "Changelog" + footer_icon_url: "https://cdn.discordapp.com/avatars/487431320314576937/bd64361e4ba6313d561d54e78c9e7171.png" + footer_timestamp: true + max_description: '16384' + reduce_headings: true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 5ac9a6ac0..000000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Gradle tests - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up JDK 21 - uses: actions/setup-java@v3 - with: - java-version: '21' - distribution: 'temurin' - - - name: Run Tests with Gradle - run: ./gradlew test - - - name: Report test results - uses: dorny/test-reporter@v2 - if: always() - with: - name: Gradle Tests - path: build/test-results/test/*.xml - reporter: java-junit - fail-on-error: true \ No newline at end of file diff --git a/build.gradle b/build.gradle index e6d6d2838..d53bb59a5 100644 --- a/build.gradle +++ b/build.gradle @@ -1,93 +1,107 @@ plugins { id 'java' - id "com.github.johnrengelman.shadow" version "8.1.1" + id 'com.github.johnrengelman.shadow' version '8.1.1' } +// Versioning +def gitRef = System.getenv("GITHUB_REF") ?: "" +def tagVersion = gitRef.replace("refs/tags/", "") +def isSnapshot = System.getenv('SNAPSHOT')?.toBoolean() ?: false +def gitHash = System.getenv('GITHUB_SHA') ?: 'local' + +def pluginVersion = tagVersion ? tagVersion : "dev" + +version = isSnapshot ? "$pluginVersion-SNAPSHOT-${gitHash.take(7)}" : pluginVersion group = 'fr.openmc' -version = "GIT-"+System.getenv("GITHUB_SHA") ?: "unknown" 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 { + 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") - 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 '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") // Version custom de Webbeh/WorldGuard-Events + 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' - // 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") + 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") - testImplementation("org.mockbukkit.mockbukkit:mockbukkit-v1.21:4.45.0") - testImplementation("com.h2database:h2:2.3.232") + 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' } def targetJavaVersion = 21 java { - def javaVersion = JavaVersion.toVersion(targetJavaVersion) - sourceCompatibility = javaVersion - targetCompatibility = javaVersion - if (JavaVersion.current() < javaVersion) { - toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) - } + sourceCompatibility = targetJavaVersion + targetCompatibility = targetJavaVersion } -tasks.withType(JavaCompile).configureEach { +tasks.withType(JavaCompile) { options.encoding = 'UTF-8' - - if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { - options.release.set(targetJavaVersion) - } + options.release = targetJavaVersion } processResources { - def props = [version: version] - inputs.properties props - filteringCharset 'UTF-8' - filesMatching('paper-plugin.yml') { - expand props + def props = ["version": version] + inputs.properties(props) + filteringCharset = 'UTF-8' + filesMatching('plugin.yml') { + expand(props) } } -jar { + +tasks.jar { manifest { - attributes("GIT-COMMIT" : System.getenv("GITHUB_SHA") ?: "unknown") + attributes 'GIT-COMMIT': gitHash } - destinationDirectory.set(file("./builds/")) + destinationDirectory.set(file('./builds/')) } -clean { - delete "builds" +tasks.clean { + delete 'builds' } -shadowJar { - destinationDirectory.set(file("./builds/")) - archiveFileName = "OpenMC.jar" +tasks.shadowJar { + destinationDirectory.set(file('./builds/')) + archiveFileName.set('OpenMC.jar') } -test { useJUnitPlatform() } - -apply plugin: "com.github.johnrengelman.shadow" \ No newline at end of file +tasks.test { + useJUnitPlatform() +} 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' diff --git a/src/test/resources/plugin.yml b/src/test/resources/plugin.yml index aa03d073b..3ec76e790 100644 --- a/src/test/resources/plugin.yml +++ b/src/test/resources/plugin.yml @@ -1,5 +1,5 @@ name: OpenMC -version: '2.0.0' +version: ${version} main: fr.openmc.core.TestPlugin api-version: '1.21.4' -prefix: OMC \ No newline at end of file +prefix: OMC From 1ad3c11f1f2e7a5cc6be9bad1d0b091afd5da604 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 17:03:42 +0200 Subject: [PATCH 48/81] add configuration of git in milestone-close --- .github/workflows/milestone-close.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index b38e5c443..0212f791f 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -15,6 +15,11 @@ jobs: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} + - name: Configure Git + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + - name: Create release tag run: | TAG_NAME="${{ github.event.milestone.title }}" From aefd35d1bf6f44a002fef1f240d48bb4f1c419e5 Mon Sep 17 00:00:00 2001 From: Piquel <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 18:06:30 +0300 Subject: [PATCH 49/81] Feat (#15) * fix: List.of() creates immutable list * fix: Rename invitation variable to avoid confusion * feat: _iambibi's work from https://github.com/ServerOpenMC/PluginV2VersioningTest * Update README.md * feat: fix creation of tag * Update README.md * Update README.md * remove adding tags on merge * feat: add merging of milestone branch into master on milestone close * feat: combined all build and test workflows * fix: clean up workflows and translate * feat: merge PR into milestone branch * Plus de tests * Update README.md (#5) * remove pr-close workflow * feat: check if target branch is correct * fix typo * fix typo * Feat (#7) * remove pr-close workflow * feat: check if target branch is correct * fix typo * fix typo * clean check-milestone * feat: milestone-create workflow * feat: add deleting branch when milestone-closed * clean up milestone workflows * Feat (#8) * remove pr-close workflow * feat: check if target branch is correct * fix typo * fix typo * clean check-milestone * feat: milestone-create workflow * feat: add deleting branch when milestone-closed * clean up milestone workflows * fix: wrong branch name * Feat (#9) * remove pr-close workflow * feat: check if target branch is correct * fix typo * fix typo * clean check-milestone * feat: milestone-create workflow * feat: add deleting branch when milestone-closed * clean up milestone workflows * fix: wrong branch name * fix: naming of jar in release workflow * feat: clean pr template * feat: workflows.md to explain the pipeline * fix: naming of jar in release workflow * feat: clean pr template * feat: workflows.md to explain the pipeline * fix: check-milestone had suplicated code * remove test * feat: simplified pipeline * fix typos (I hope) * feat: add automatic release notes generation * translated release.yml * remove unnecessary step in PR template * fix: version numbre not being set properly in plugin.yml * feat: removed unneccessary workflows * feat: release posted on discord * fix checkout version for discord notif * change actions version * fix: change @ in discord notification * simplify workflows * add configuration of git in milestone-close --------- Co-authored-by: GitHub Actions --- .github/workflows/milestone-close.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index b38e5c443..866cdc89b 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -15,6 +15,11 @@ jobs: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} + - name: Configure Git + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + - name: Create release tag run: | TAG_NAME="${{ github.event.milestone.title }}" From 37df85d7d47b108a42484911d832dade0747c406 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 17:14:36 +0200 Subject: [PATCH 50/81] fix: tag name in milestone-close --- .github/workflows/milestone-close.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 866cdc89b..ce225282e 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -40,21 +40,21 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: OpenMC-${{ steps.milestone.outputs.milestone_title }} + name: OpenMC-${{ github.event.milestone.title }} path: builds/ - name: Create GitHub Release uses: softprops/action-gh-release@v2 with: - tag_name: ${{ steps.tag.outputs.tag_name }} - name: Release ${{ steps.milestone.outputs.milestone_title }} + tag_name: ${{ github.event.milestone.title }} + name: Release milestone ${{ github.event.milestone.title }} generate_release_notes: true body: | - # Release milestone ${{ steps.milestone.outputs.milestone_title }} + # Release milestone ${{ github.event.milestone.title }} ${{ github.event.milestone.description }} - This release was automatically created when milestone "${{ steps.milestone.outputs.milestone_title }}" was closed. + This release was automatically created when milestone "${{ github.event.milestone.title }}" was closed. files: builds/ env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From ec6e4b0a6de08a6baa18fd94c1d775db23a3a82e Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 17:38:55 +0200 Subject: [PATCH 51/81] improve milestone-close release-create --- .github/workflows/milestone-close.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index ce225282e..4e986a120 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -49,12 +49,14 @@ jobs: tag_name: ${{ github.event.milestone.title }} name: Release milestone ${{ github.event.milestone.title }} generate_release_notes: true + fail_on_unmatched_files: true + make_latest: "true" body: | # Release milestone ${{ github.event.milestone.title }} ${{ github.event.milestone.description }} This release was automatically created when milestone "${{ github.event.milestone.title }}" was closed. - files: builds/ + files: builds/** env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 644322bf817c0133c4b6425d1de13feac93f7ced Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 17:43:03 +0200 Subject: [PATCH 52/81] fix: wrong filepath for release --- .github/workflows/milestone-close.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 4e986a120..ce065dd56 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -50,13 +50,13 @@ jobs: name: Release milestone ${{ github.event.milestone.title }} generate_release_notes: true fail_on_unmatched_files: true - make_latest: "true" + make_latest: true body: | # Release milestone ${{ github.event.milestone.title }} ${{ github.event.milestone.description }} This release was automatically created when milestone "${{ github.event.milestone.title }}" was closed. - files: builds/** + files: builds/OpenMC-${{ github.event.milestone.title }}.jar env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 41d9449a94325af3f781188f20d31eb554ef15f5 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 17:45:45 +0200 Subject: [PATCH 53/81] undo last thing --- .github/workflows/milestone-close.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index ce065dd56..e261fa061 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -57,6 +57,6 @@ jobs: ${{ github.event.milestone.description }} This release was automatically created when milestone "${{ github.event.milestone.title }}" was closed. - files: builds/OpenMC-${{ github.event.milestone.title }}.jar + files: builds/** env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From a7da410111c85adb22825ba99cdb59688feef2c4 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 17:50:07 +0200 Subject: [PATCH 54/81] removed old stuff from milestone-close --- .github/workflows/milestone-close.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index e261fa061..711ff8f5f 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -11,21 +11,7 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - name: Configure Git - run: | - git config user.name "GitHub Actions" - git config user.email "actions@github.com" - - - name: Create release tag - run: | - TAG_NAME="${{ github.event.milestone.title }}" - git tag -a $TAG_NAME -m "Release ${{ github.event.milestone.title }}" - git push origin $TAG_NAME - - name: Set up JDK 21 uses: actions/setup-java@v4 with: From e58e49cb85c08a219bbd507872edafa867e7a9bb Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 18:00:54 +0200 Subject: [PATCH 55/81] feat: simplify tag system --- .github/workflows/build-test.yml | 1 + .github/workflows/milestone-close.yml | 2 ++ build.gradle | 5 ++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 1ba3fd9b9..d4c64d207 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -64,6 +64,7 @@ jobs: - name: Build with snapshot version env: + TAG: actions SNAPSHOT: true GITHUB_SHA: ${{ github.sha }} run: ./gradlew jar diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 711ff8f5f..598295cd5 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -22,6 +22,8 @@ jobs: run: chmod +x ./gradlew - name: Build with Gradle run: ./gradlew jar + env: + TAG: ${{ github.event.milestone.title }} - name: Upload artifact uses: actions/upload-artifact@v4 diff --git a/build.gradle b/build.gradle index d53bb59a5..273d1d4db 100644 --- a/build.gradle +++ b/build.gradle @@ -4,12 +4,11 @@ plugins { } // Versioning -def gitRef = System.getenv("GITHUB_REF") ?: "" -def tagVersion = gitRef.replace("refs/tags/", "") +def tag = System.getenv("TAG") ?: "" def isSnapshot = System.getenv('SNAPSHOT')?.toBoolean() ?: false def gitHash = System.getenv('GITHUB_SHA') ?: 'local' -def pluginVersion = tagVersion ? tagVersion : "dev" +def pluginVersion = tag ? tag : "dev" version = isSnapshot ? "$pluginVersion-SNAPSHOT-${gitHash.take(7)}" : pluginVersion group = 'fr.openmc' From cf445946dcbd9ed7680f4fc373d9df5b0591e761 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Wed, 23 Apr 2025 18:04:57 +0200 Subject: [PATCH 56/81] feat: add tagless binary to release --- .github/workflows/milestone-close.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 598295cd5..6f78d5ead 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -21,7 +21,9 @@ jobs: - name: Make gradlew executable run: chmod +x ./gradlew - name: Build with Gradle - run: ./gradlew jar + run: | + ./gradlew shadowJar + cp ./builds/OpenMC.jar ./builds/OpenMC-$TAG.jar env: TAG: ${{ github.event.milestone.title }} From 488b279a79dfebd3e69f79d1875eeba3d1c6733b Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Thu, 24 Apr 2025 08:54:41 +0200 Subject: [PATCH 57/81] feat: add deploy to server to milestone-close --- .github/workflows/build-test.yml | 2 +- .github/workflows/milestone-close.yml | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index d4c64d207..9215d5ea2 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -64,7 +64,7 @@ jobs: - name: Build with snapshot version env: - TAG: actions + TAG: github SNAPSHOT: true GITHUB_SHA: ${{ github.sha }} run: ./gradlew jar diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 6f78d5ead..f56216f8a 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -50,3 +50,13 @@ jobs: files: builds/** env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Deploy to server + uses: rexlmanu/pterodactyl-upload-action@v2.4 + with: + panel-host: ${{ secrets.PANEL_HOST }} + api-key: ${{ secrets.API_KEY }} + server-id: ${{ secrets.SERVER_ID }} + source: builds/OpenMC.jar + target: "./plugins/OpenMC.jar" + restart: true From ca074a28223857b5465ec94ae623a568aa5f348a Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Thu, 24 Apr 2025 08:54:58 +0200 Subject: [PATCH 58/81] fix branding of discord release --- .github/workflows/release-to-discord.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-to-discord.yml b/.github/workflows/release-to-discord.yml index 2f853137b..bba47c5d9 100644 --- a/.github/workflows/release-to-discord.yml +++ b/.github/workflows/release-to-discord.yml @@ -14,12 +14,12 @@ jobs: uses: SethCohen/github-releases-to-discord@v1.16.2 with: webhook_url: ${{ secrets.WEBHOOK_URL }} - color: "2105893" - username: "OpenMC Update" - avatar_url: "https://cdn.discordapp.com/avatars/487431320314576937/bd64361e4ba6313d561d54e78c9e7171.png" + color: "16021398" # decimal of #f47796 + username: "OpenMC Plugin Update" + avatar_url: "https://raw.githubusercontent.com/ServerOpenMC/.github/refs/heads/master/brandkit/logo.png" content: "||@• Notifs OpenMC||" footer_title: "Changelog" - footer_icon_url: "https://cdn.discordapp.com/avatars/487431320314576937/bd64361e4ba6313d561d54e78c9e7171.png" + footer_icon_url: "https://raw.githubusercontent.com/ServerOpenMC/.github/refs/heads/master/brandkit/logo.png" footer_timestamp: true max_description: '16384' reduce_headings: true From 7d1bc73cf02c0ddf9b1b6a9f1215282f5727575a Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Thu, 24 Apr 2025 09:05:03 +0200 Subject: [PATCH 59/81] feat: join message with milestone url --- .github/workflows/milestone-close.yml | 1 + build.gradle | 5 +++-- .../fr/openmc/core/listeners/JoinMessageListener.java | 11 ++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index f56216f8a..1231303b3 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -26,6 +26,7 @@ jobs: cp ./builds/OpenMC.jar ./builds/OpenMC-$TAG.jar env: TAG: ${{ github.event.milestone.title }} + MILESTONE_URL: ${{ github.event.milestone.url }} - name: Upload artifact uses: actions/upload-artifact@v4 diff --git a/build.gradle b/build.gradle index 273d1d4db..1c97547d3 100644 --- a/build.gradle +++ b/build.gradle @@ -5,6 +5,7 @@ plugins { // Versioning def tag = System.getenv("TAG") ?: "" +def milestoneUrl = System.getenv("MILESTONE_URL") ?: "" def isSnapshot = System.getenv('SNAPSHOT')?.toBoolean() ?: false def gitHash = System.getenv('GITHUB_SHA') ?: 'local' @@ -77,10 +78,10 @@ tasks.withType(JavaCompile) { } processResources { - def props = ["version": version] + def props = ["version": version, "milestoneUrl": milestoneUrl] inputs.properties(props) filteringCharset = 'UTF-8' - filesMatching('plugin.yml') { + filesMatching('plugin.yml', 'JoinMessageListener.java') { expand(props) } } diff --git a/src/main/java/fr/openmc/core/listeners/JoinMessageListener.java b/src/main/java/fr/openmc/core/listeners/JoinMessageListener.java index 3811665c3..9132c3ff0 100644 --- a/src/main/java/fr/openmc/core/listeners/JoinMessageListener.java +++ b/src/main/java/fr/openmc/core/listeners/JoinMessageListener.java @@ -10,6 +10,8 @@ import fr.openmc.core.utils.messages.MessagesManager; import fr.openmc.core.utils.messages.Prefix; import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.event.ClickEvent; + import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -25,6 +27,13 @@ public class JoinMessageListener implements Listener { public void onPlayerJoin(PlayerJoinEvent event) { final Player player = event.getPlayer(); + MessagesManager.sendMessage(player, Component.text("Bienvenu sur OpenMC !"), Prefix.OPENMC, MessageType.INFO, false); + MessagesManager.sendMessage(player, Component.text("Vous jouez actuellement sur la version ") + .append(Component.text("${version}").clickEvent(ClickEvent.openUrl("${milestoneUrl}"))) + .append(Component.text(" du plugin §aOpenMC§. Cliquez ici pour voir les changements.")) + .append(Component.text(" Cliquez ici pour voir les changements.").clickEvent(ClickEvent.openUrl("${milestone_url}"))) + , Prefix.OPENMC, MessageType.INFO, false); + TabList.getInstance().updateTabList(player); FriendManager.getInstance().getFriendsAsync(player.getUniqueId()).thenAccept(friendsUUIDS -> { @@ -74,4 +83,4 @@ public void onPlayerQuit(PlayerQuitEvent event) { event.quitMessage(Component.text("§8[§c§l-§8] §r" + "§r" + LuckPermsAPI.getFormattedPAPIPrefix(player) + player.getName())); } -} \ No newline at end of file +} From 51eb021c3679a97db7581164925ebe4e71fb7118 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Thu, 24 Apr 2025 09:11:07 +0200 Subject: [PATCH 60/81] fix: error expanding version and milestone url in build.gradle --- build.gradle | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 1c97547d3..7bacdb0c1 100644 --- a/build.gradle +++ b/build.gradle @@ -78,11 +78,18 @@ tasks.withType(JavaCompile) { } processResources { - def props = ["version": version, "milestoneUrl": milestoneUrl] - inputs.properties(props) filteringCharset = 'UTF-8' - filesMatching('plugin.yml', 'JoinMessageListener.java') { - expand(props) + + def pluginProps = ["version": version] + inputs.properties(pluginProps) + filesMatching('plugin.yml') { + expand(pluginProps) + } + + def joinListenerProps = ["version": version, "milestoneUrl": milestoneUrl] + inputs.properties(joinListenerProps) + filesMatching('JoinMessageListener.java') { + expand(joinListenerProps) } } From ad1156c2c2f9fc7833300ae8b90910397aa2b39f Mon Sep 17 00:00:00 2001 From: Piquel <63727792+PiquelChips@users.noreply.github.com> Date: Thu, 24 Apr 2025 09:53:41 +0200 Subject: [PATCH 61/81] fix: token used for milestone-close release --- .github/workflows/milestone-close.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 598295cd5..3be62c176 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -47,4 +47,4 @@ jobs: This release was automatically created when milestone "${{ github.event.milestone.title }}" was closed. files: builds/** env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} From ed7fed3a86e61c662b2d47534bb8611690c69618 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Fri, 25 Apr 2025 12:18:04 +0200 Subject: [PATCH 62/81] feat: name format verification --- .github/workflows/milestone-close.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 6bf445f3e..8d6b45fab 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -9,6 +9,8 @@ jobs: name: Release runs-on: ubuntu-latest steps: + - name: Verify Milestone Name + run: if [[ ${{ github.event.milestone.title }} =~ ^\d+\.\d+\.\d+$ ]] || echo "Name ${{ github.event.milestone.title }} is not valid" & exit 1 - name: Checkout repository uses: actions/checkout@v4 @@ -60,4 +62,4 @@ jobs: server-id: ${{ secrets.SERVER_ID }} source: builds/OpenMC.jar target: "./plugins/OpenMC.jar" - restart: true \ No newline at end of file + restart: true From 2823866cb6ec8f4028c0552898b0abbf267ec212 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Fri, 25 Apr 2025 12:20:21 +0200 Subject: [PATCH 63/81] feaet: remove . from file name --- .github/workflows/milestone-close.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 8d6b45fab..cf27df053 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -24,8 +24,9 @@ jobs: run: chmod +x ./gradlew - name: Build with Gradle run: | + VERSION=$(echo ${{ github.event.milestone.title }} | tr "." "_") ./gradlew shadowJar - cp ./builds/OpenMC.jar ./builds/OpenMC-$TAG.jar + cp ./builds/OpenMC.jar ./builds/OpenMC-$VERSION.jar env: TAG: ${{ github.event.milestone.title }} MILESTONE_URL: ${{ github.event.milestone.url }} From 1316e998c29b32130953d5b4982219a434e49ecf Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Fri, 25 Apr 2025 12:24:46 +0200 Subject: [PATCH 64/81] fix name check --- .github/workflows/milestone-close.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index cf27df053..7216dcc5c 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -10,7 +10,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Verify Milestone Name - run: if [[ ${{ github.event.milestone.title }} =~ ^\d+\.\d+\.\d+$ ]] || echo "Name ${{ github.event.milestone.title }} is not valid" & exit 1 + run: | + if ![[ "${{ github.event.milestone.title }}" =~ ^\d+\.\d+\.\d+$ ]]; then + echo "Name ${{ github.event.milestone.title }} is not valid" + exit 1 + fi - name: Checkout repository uses: actions/checkout@v4 From 537ddd38c2dcbe1ab52f80daea91d6261c03186f Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Fri, 25 Apr 2025 12:28:17 +0200 Subject: [PATCH 65/81] fix name check --- .github/workflows/milestone-close.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 7216dcc5c..4a79b279a 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Verify Milestone Name run: | - if ![[ "${{ github.event.milestone.title }}" =~ ^\d+\.\d+\.\d+$ ]]; then + if [[ ! "${{ github.event.milestone.title }}" =~ ^\d+\.\d+\.\d+$ ]]; then echo "Name ${{ github.event.milestone.title }} is not valid" exit 1 fi From e1705a71e92a5155634a188ef43d6930ddd7e292 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Fri, 25 Apr 2025 12:32:59 +0200 Subject: [PATCH 66/81] fix regex pattern --- .github/workflows/milestone-close.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 4a79b279a..22a35566a 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Verify Milestone Name run: | - if [[ ! "${{ github.event.milestone.title }}" =~ ^\d+\.\d+\.\d+$ ]]; then + if [[ ! "${{ github.event.milestone.title }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then echo "Name ${{ github.event.milestone.title }} is not valid" exit 1 fi From 131f1f835f04880e45d7fb73f1fffefe9cb194a3 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Fri, 25 Apr 2025 12:48:35 +0200 Subject: [PATCH 67/81] fix: build.gradle naming scheme --- build.gradle | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 7bacdb0c1..fa9badae4 100644 --- a/build.gradle +++ b/build.gradle @@ -3,15 +3,26 @@ plugins { id 'com.github.johnrengelman.shadow' version '8.1.1' } +def getLatestGitTag() { + try { + def stdout = new ByteArrayOutputStream() + exec { + commandLine 'git', 'describe', '--tags', '--abbrev=0' + standardOutput = stdout + } + return stdout.toString().trim() + } catch (Exception e) { + return "unknwon" // Default value if no tags exist + } +} + // Versioning -def tag = System.getenv("TAG") ?: "" +def tag = System.getenv("TAG") ?: getLatestGitTag() def milestoneUrl = System.getenv("MILESTONE_URL") ?: "" def isSnapshot = System.getenv('SNAPSHOT')?.toBoolean() ?: false def gitHash = System.getenv('GITHUB_SHA') ?: 'local' -def pluginVersion = tag ? tag : "dev" - -version = isSnapshot ? "$pluginVersion-SNAPSHOT-${gitHash.take(7)}" : pluginVersion +version = isSnapshot ? "$tag-SNAPSHOT-${gitHash.take(7)}" : tag group = 'fr.openmc' repositories { From f583ccda7d0dc2761c8c98de9787a2ea35eef49b Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Fri, 25 Apr 2025 13:12:05 +0200 Subject: [PATCH 68/81] fix tag system --- .github/workflows/build-test.yml | 1 - build.gradle | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 9215d5ea2..1ba3fd9b9 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -64,7 +64,6 @@ jobs: - name: Build with snapshot version env: - TAG: github SNAPSHOT: true GITHUB_SHA: ${{ github.sha }} run: ./gradlew jar diff --git a/build.gradle b/build.gradle index fa9badae4..e267f3098 100644 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,7 @@ def milestoneUrl = System.getenv("MILESTONE_URL") ?: "" def isSnapshot = System.getenv('SNAPSHOT')?.toBoolean() ?: false def gitHash = System.getenv('GITHUB_SHA') ?: 'local' -version = isSnapshot ? "$tag-SNAPSHOT-${gitHash.take(7)}" : tag +version = isSnapshot ? "$tag-SNAPSHOT-${gitHash.take(7)}" : (System.getenv("TAG") ? tag : "dev-$tag") group = 'fr.openmc' repositories { From f1ec108170706d18e0c51071d713cf2b80e709a2 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Fri, 25 Apr 2025 14:18:36 +0200 Subject: [PATCH 69/81] fix indentation --- .../core/features/economy/EconomyManager.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/fr/openmc/core/features/economy/EconomyManager.java b/src/main/java/fr/openmc/core/features/economy/EconomyManager.java index 98ced2b38..9dc6d4dc7 100644 --- a/src/main/java/fr/openmc/core/features/economy/EconomyManager.java +++ b/src/main/java/fr/openmc/core/features/economy/EconomyManager.java @@ -96,24 +96,24 @@ public String getFormattedNumber(double number) { } public static String getFormattedSimplifiedNumber(double balance) { - if (balance == 0) { - return "0"; - } - - Map.Entry entry = instance.suffixes.floorEntry((long) balance); - if (entry == null) { - return instance.decimalFormat.format(balance); + if (balance == 0) { + return "0"; + } + + Map.Entry entry = instance.suffixes.floorEntry((long) balance); + if (entry == null) { + return instance.decimalFormat.format(balance); + } + + long divideBy = entry.getKey(); + String suffix = entry.getValue(); + + double truncated = balance / divideBy; + String formatted = instance.decimalFormat.format(truncated); + + return formatted + suffix; } - long divideBy = entry.getKey(); - String suffix = entry.getValue(); - - double truncated = balance / divideBy; - String formatted = instance.decimalFormat.format(truncated); - - return formatted + suffix; -} - public static String getEconomyIcon() { if(Bukkit.getPluginManager().getPlugin("ItemsAdder") != null && Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) { return "§f" + PlaceholderAPI.setPlaceholders(null, "%img_aywenito%"); From 62ad36ef714fefb024b5b21c4fe84d1076b0ef66 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Fri, 25 Apr 2025 14:36:50 +0200 Subject: [PATCH 70/81] fix: welcome message --- .github/workflows/milestone-close.yml | 1 - build.gradle | 7 ------- .../core/listeners/JoinMessageListener.java | 15 ++++++++++++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 22a35566a..7ddc33f42 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -33,7 +33,6 @@ jobs: cp ./builds/OpenMC.jar ./builds/OpenMC-$VERSION.jar env: TAG: ${{ github.event.milestone.title }} - MILESTONE_URL: ${{ github.event.milestone.url }} - name: Upload artifact uses: actions/upload-artifact@v4 diff --git a/build.gradle b/build.gradle index e267f3098..edc6dd790 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,6 @@ def getLatestGitTag() { // Versioning def tag = System.getenv("TAG") ?: getLatestGitTag() -def milestoneUrl = System.getenv("MILESTONE_URL") ?: "" def isSnapshot = System.getenv('SNAPSHOT')?.toBoolean() ?: false def gitHash = System.getenv('GITHUB_SHA') ?: 'local' @@ -96,12 +95,6 @@ processResources { filesMatching('plugin.yml') { expand(pluginProps) } - - def joinListenerProps = ["version": version, "milestoneUrl": milestoneUrl] - inputs.properties(joinListenerProps) - filesMatching('JoinMessageListener.java') { - expand(joinListenerProps) - } } tasks.jar { diff --git a/src/main/java/fr/openmc/core/listeners/JoinMessageListener.java b/src/main/java/fr/openmc/core/listeners/JoinMessageListener.java index 9132c3ff0..a990e76ce 100644 --- a/src/main/java/fr/openmc/core/listeners/JoinMessageListener.java +++ b/src/main/java/fr/openmc/core/listeners/JoinMessageListener.java @@ -27,11 +27,20 @@ public class JoinMessageListener implements Listener { public void onPlayerJoin(PlayerJoinEvent event) { final Player player = event.getPlayer(); + String version = OMCPlugin.getInstance().getDescription().getVersion(); + String milestoneUrl = "https://github.com/ServerOpenMC/PluginV2/releases/"; + + if (version.matches("^\\d+\\.\\d+\\.\\d+$")) { + milestoneUrl += "tag/" + version; + } else { + milestoneUrl += "latest"; + } + MessagesManager.sendMessage(player, Component.text("Bienvenu sur OpenMC !"), Prefix.OPENMC, MessageType.INFO, false); MessagesManager.sendMessage(player, Component.text("Vous jouez actuellement sur la version ") - .append(Component.text("${version}").clickEvent(ClickEvent.openUrl("${milestoneUrl}"))) - .append(Component.text(" du plugin §aOpenMC§. Cliquez ici pour voir les changements.")) - .append(Component.text(" Cliquez ici pour voir les changements.").clickEvent(ClickEvent.openUrl("${milestone_url}"))) + .append(Component.text(version).clickEvent(ClickEvent.openUrl(milestoneUrl))) + .append(Component.text(" du plugin §aOpenMC§r.")) + .append(Component.text(" Cliquez ici pour voir les changements.").clickEvent(ClickEvent.openUrl(milestoneUrl))) , Prefix.OPENMC, MessageType.INFO, false); TabList.getInstance().updateTabList(player); From b47742cf1ee48266cce37cc28b3d954ff5677c85 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Fri, 25 Apr 2025 16:21:44 +0200 Subject: [PATCH 71/81] feat: /omcrestart --- .../java/fr/openmc/core/CommandsManager.java | 3 +- .../openmc/core/commands/utils/Restart.java | 54 +++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 src/main/java/fr/openmc/core/commands/utils/Restart.java diff --git a/src/main/java/fr/openmc/core/CommandsManager.java b/src/main/java/fr/openmc/core/CommandsManager.java index 0db2166a8..cab287f6d 100644 --- a/src/main/java/fr/openmc/core/CommandsManager.java +++ b/src/main/java/fr/openmc/core/CommandsManager.java @@ -44,6 +44,7 @@ private void registerCommands() { new MailboxCommand(OMCPlugin.getInstance()), new FriendCommand(), new QuestCommand(), + new Restart(), new AdminShopCommand() ); } @@ -51,4 +52,4 @@ private void registerCommands() { private void registerSuggestions() { FriendManager.getInstance().initCommandSuggestion(); } -} \ No newline at end of file +} diff --git a/src/main/java/fr/openmc/core/commands/utils/Restart.java b/src/main/java/fr/openmc/core/commands/utils/Restart.java new file mode 100644 index 000000000..b5a4c547a --- /dev/null +++ b/src/main/java/fr/openmc/core/commands/utils/Restart.java @@ -0,0 +1,54 @@ +package fr.openmc.core.commands.utils; + +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; + +import fr.openmc.core.OMCPlugin; +import fr.openmc.core.utils.messages.MessageType; +import fr.openmc.core.utils.messages.MessagesManager; +import fr.openmc.core.utils.messages.Prefix; +import lombok.Setter; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.title.Title; +import revxrsal.commands.annotation.Command; +import revxrsal.commands.annotation.Description; +import revxrsal.commands.bukkit.annotation.CommandPermission; + +public class Restart { + + private static List annouce = List.of(60, 30, 15, 10, 5, 4, 3, 2, 1); + + @Command("omcrestart") + @Description("Redémarre le serveur après 1min") + @CommandPermission("omc.admin.commands.restart") + public void restart() { + OMCPlugin plugin = OMCPlugin.getInstance(); + BukkitRunnable update = new BukkitRunnable() { + public int remainingTime = 60; + + @Override + public void run() { + if (remainingTime == 0) + Bukkit.getServer().restart(); + + if (!annouce.contains(remainingTime)) { + remainingTime -= 1; + return; + } + + Component message = Component.text("Redémarrage du serveur dans " + remainingTime + " seconde" + (remainingTime == 1 ? "" : "s")); + for (Player player : Bukkit.getOnlinePlayers()) { + MessagesManager.sendMessage(player, message, Prefix.OPENMC, MessageType.WARNING, true); + Title title = Title.title(Component.text("Redémarrage"), Component.text(remainingTime + " seconde" + (remainingTime == 1 ? "" : "s"))); + player.showTitle(title); + } + remainingTime -= 1; + } + }; + + update.runTaskTimer(plugin, 20, 20); + } +} From e716ff66ab8db697ad9e12718e833becdca87fa1 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Fri, 25 Apr 2025 16:31:42 +0200 Subject: [PATCH 72/81] fix: dont restart pterodactyl server --- .github/workflows/milestone-close.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 7ddc33f42..84ae882ca 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -66,4 +66,3 @@ jobs: server-id: ${{ secrets.SERVER_ID }} source: builds/OpenMC.jar target: "./plugins/OpenMC.jar" - restart: true From a2a4bc64366733ca47e0abc52a26216955920be0 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Fri, 25 Apr 2025 20:27:53 +0200 Subject: [PATCH 73/81] feat: make restart work in console properly --- .../java/fr/openmc/core/commands/utils/Restart.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/openmc/core/commands/utils/Restart.java b/src/main/java/fr/openmc/core/commands/utils/Restart.java index b5a4c547a..cf6fb56b9 100644 --- a/src/main/java/fr/openmc/core/commands/utils/Restart.java +++ b/src/main/java/fr/openmc/core/commands/utils/Restart.java @@ -12,6 +12,7 @@ import fr.openmc.core.utils.messages.Prefix; import lombok.Setter; import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.title.Title; import revxrsal.commands.annotation.Command; import revxrsal.commands.annotation.Description; @@ -39,16 +40,21 @@ public void run() { return; } - Component message = Component.text("Redémarrage du serveur dans " + remainingTime + " seconde" + (remainingTime == 1 ? "" : "s")); + Component broadcast = Component.text("§7(" + MessageType.WARNING.getPrefix() + "§7) ") + .append(MiniMessage.miniMessage().deserialize(Prefix.OPENMC.getPrefix())) + .append(Component.text(" §7» ") + .append(Component.text("Redémarrage du serveur dans " + remainingTime + " seconde" + (remainingTime == 1 ? "" : "s")))); + + Bukkit.broadcast(broadcast); + for (Player player : Bukkit.getOnlinePlayers()) { - MessagesManager.sendMessage(player, message, Prefix.OPENMC, MessageType.WARNING, true); Title title = Title.title(Component.text("Redémarrage"), Component.text(remainingTime + " seconde" + (remainingTime == 1 ? "" : "s"))); player.showTitle(title); } remainingTime -= 1; } }; - + update.runTaskTimer(plugin, 20, 20); } } From 41f99e27ec4c0172a8924b35f27b1d4a88333ad0 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Fri, 25 Apr 2025 20:37:28 +0200 Subject: [PATCH 74/81] feat: modifie regex for more patters + explain error --- .github/workflows/milestone-close.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 84ae882ca..80170bbfa 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -11,8 +11,9 @@ jobs: steps: - name: Verify Milestone Name run: | - if [[ ! "${{ github.event.milestone.title }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + if [[ ! "${{ github.event.milestone.title }}" =~ ^[a-zA-Z-\._0-9]+$ ]]; then echo "Name ${{ github.event.milestone.title }} is not valid" + echo "It should only contain letters (a-z & A-Z), periods (.), dashes (-) and underscores (_)" exit 1 fi - name: Checkout repository From e2602a44791adb1369a30f66be8a2d3b1dc49fcb Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Sat, 26 Apr 2025 09:46:56 +0200 Subject: [PATCH 75/81] feat: only console can send the message --- src/main/java/fr/openmc/core/commands/utils/Restart.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/openmc/core/commands/utils/Restart.java b/src/main/java/fr/openmc/core/commands/utils/Restart.java index cf6fb56b9..8b4ec035b 100644 --- a/src/main/java/fr/openmc/core/commands/utils/Restart.java +++ b/src/main/java/fr/openmc/core/commands/utils/Restart.java @@ -3,6 +3,7 @@ import java.util.List; import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; @@ -25,7 +26,12 @@ public class Restart { @Command("omcrestart") @Description("Redémarre le serveur après 1min") @CommandPermission("omc.admin.commands.restart") - public void restart() { + public void restart(CommandSender sender) { + if (sender instanceof Player) { + MessagesManager.sendMessage(sender, MessagesManager.Message.NOPERMISSION.getMessage(), Prefix.OPENMC, MessageType.ERROR, false); + return; + } + OMCPlugin plugin = OMCPlugin.getInstance(); BukkitRunnable update = new BukkitRunnable() { public int remainingTime = 60; From d7b4c40081a102aa2da1c30c48938d3c827f7393 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Sat, 26 Apr 2025 11:48:37 +0200 Subject: [PATCH 76/81] translate discord release --- .github/release.yml | 6 +++--- .github/workflows/release-to-discord.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/release.yml b/.github/release.yml index 1bcf4179e..5ede6a2e6 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,14 +1,14 @@ changelog: categories: - - title: New Features + - title: Nouvelles Fonctionnalités labels: - "🆙 Amélioration" - ":arrows_counterclockwise: Changement" - ":package: Features" - - title: Bugs and Optimizations + - title: Bugs et Optimisations labels: - "⚡Optimisation" - ":sparkles: Fixes" - - title: Other + - title: Autre labels: - "*" diff --git a/.github/workflows/release-to-discord.yml b/.github/workflows/release-to-discord.yml index bba47c5d9..d2f82f1ac 100644 --- a/.github/workflows/release-to-discord.yml +++ b/.github/workflows/release-to-discord.yml @@ -15,10 +15,10 @@ jobs: with: webhook_url: ${{ secrets.WEBHOOK_URL }} color: "16021398" # decimal of #f47796 - username: "OpenMC Plugin Update" + username: "Mise à jour de OpenMC" avatar_url: "https://raw.githubusercontent.com/ServerOpenMC/.github/refs/heads/master/brandkit/logo.png" - content: "||@• Notifs OpenMC||" - footer_title: "Changelog" + #content: "||<@&1258420105209974804>||" + footer_title: "Changements" footer_icon_url: "https://raw.githubusercontent.com/ServerOpenMC/.github/refs/heads/master/brandkit/logo.png" footer_timestamp: true max_description: '16384' From 5beab1b7dd34fa7a380f20234184a677296cef9c Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Sat, 26 Apr 2025 13:31:31 +0200 Subject: [PATCH 77/81] fix translattion --- .github/workflows/milestone-close.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 80170bbfa..18ab4a4c4 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -50,11 +50,11 @@ jobs: fail_on_unmatched_files: true make_latest: true body: | - # Release milestone ${{ github.event.milestone.title }} + # Mise à jour ${{ github.event.milestone.title }} ${{ github.event.milestone.description }} - This release was automatically created when milestone "${{ github.event.milestone.title }}" was closed. + Cette mise à jour à été créée automatiquement a la fermeture de la milsetone "${{ github.event.milestone.title }}". files: builds/** env: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} From c0b863ac515dd1cfd5caa6c9aa81b487e874b76b Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Sat, 26 Apr 2025 14:09:05 +0200 Subject: [PATCH 78/81] feat: add sending console command on release --- .github/workflows/milestone-close.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 18ab4a4c4..5802c29a1 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -60,10 +60,11 @@ jobs: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} - name: Deploy to server - uses: rexlmanu/pterodactyl-upload-action@v2.4 + uses: PiquelChips/pterodactyl-upload-action@v2.5 with: panel-host: ${{ secrets.PANEL_HOST }} api-key: ${{ secrets.API_KEY }} server-id: ${{ secrets.SERVER_ID }} source: builds/OpenMC.jar target: "./plugins/OpenMC.jar" + command: omcrestart From 75e816a94f66b8a7b83f07f7aae2a7d60ba5fee5 Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Sat, 26 Apr 2025 14:17:13 +0200 Subject: [PATCH 79/81] fix regex --- .github/workflows/milestone-close.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 5802c29a1..ce98813e7 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Verify Milestone Name run: | - if [[ ! "${{ github.event.milestone.title }}" =~ ^[a-zA-Z-\._0-9]+$ ]]; then + if [[ ! "${{ github.event.milestone.title }}" =~ ^[a-zA-Z-\\._0-9]+$ ]]; then echo "Name ${{ github.event.milestone.title }} is not valid" echo "It should only contain letters (a-z & A-Z), periods (.), dashes (-) and underscores (_)" exit 1 From 354c51f2de92d0316a6b30a2dc669181e28df06d Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Sat, 26 Apr 2025 14:23:41 +0200 Subject: [PATCH 80/81] fix regex --- .github/workflows/milestone-close.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index ce98813e7..09141e1eb 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -11,9 +11,9 @@ jobs: steps: - name: Verify Milestone Name run: | - if [[ ! "${{ github.event.milestone.title }}" =~ ^[a-zA-Z-\\._0-9]+$ ]]; then - echo "Name ${{ github.event.milestone.title }} is not valid" - echo "It should only contain letters (a-z & A-Z), periods (.), dashes (-) and underscores (_)" + if [[ ! "${{ github.event.milestone.title }}" =~ ^[a-zA-Z0-9_\.\-]+$ ]]; then + echo "Name '${{ github.event.milestone.title }}' is not valid" + echo "It should only contain letters (a-z & A-Z), numbers (0-9), periods (.), dashes (-) and underscores (_)" exit 1 fi - name: Checkout repository From e9993f94c5bdc8b49f5242f17760af4fd394981c Mon Sep 17 00:00:00 2001 From: PiquelChips <63727792+PiquelChips@users.noreply.github.com> Date: Sat, 26 Apr 2025 18:54:18 +0200 Subject: [PATCH 81/81] use ServerOpenMC action for pterodactyl upload --- .github/workflows/milestone-close.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/milestone-close.yml b/.github/workflows/milestone-close.yml index 09141e1eb..f99ef57b6 100644 --- a/.github/workflows/milestone-close.yml +++ b/.github/workflows/milestone-close.yml @@ -60,7 +60,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} - name: Deploy to server - uses: PiquelChips/pterodactyl-upload-action@v2.5 + uses: ServerOpenMC/pterodactyl-upload-action@v2.5 with: panel-host: ${{ secrets.PANEL_HOST }} api-key: ${{ secrets.API_KEY }}