Skip to content
Closed

Test #270

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

37 changes: 37 additions & 0 deletions .github/workflows/pull-request-build.yml
Original file line number Diff line number Diff line change
@@ -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/
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release Stable Jar

on:
milestone:
types: [closed]

permissions:
contents: write

jobs:
build:
if: startsWith(github.event.milestone.title, '2.') # Evite =~ qui n'existe pas ici
runs-on: ubuntu-latest

env:
SNAPSHOT: false

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 for Gradle
run: chmod +x ./gradlew

- name: Build with Gradle
run: ./gradlew clean shadowJar

- name: Create Release directory
run: mkdir -p release && mv builds/OpenMC.jar release/OpenMC-${{ github.event.milestone.title }}.jar

- name: Upload Release Artifact
uses: actions/upload-artifact@v4
with:
name: OpenMC-${{ github.event.milestone.title }}
path: release/OpenMC-${{ github.event.milestone.title }}.jar

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: OpenMC ${{ github.event.milestone.title }}
tag_name: ${{ github.event.milestone.title }}
files: release/OpenMC-${{ github.event.milestone.title }}.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126 changes: 69 additions & 57 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,93 +1,105 @@
plugins {
id 'java'
id "com.github.johnrengelman.shadow" version "8.1.1"
id 'com.github.johnrengelman.shadow' version '8.1.1'
}

// Versioning
def pluginVersion = '2.0.0'
def gitHash = System.getenv('GITHUB_SHA') ?: 'local'
def isSnapshot = System.getenv('SNAPSHOT')?.toBoolean() ?: false

version = isSnapshot ? "$pluginVersion-SNAPSHOT-${gitHash.take(7)}" : pluginVersion
group = 'fr.openmc'
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'
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"
1 change: 1 addition & 0 deletions src/main/java/fr/openmc/core/ListenersManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ private void registerEvents(Listener... args) {
}
}
}

2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: OpenMC
version: '2.0.0'
version: ${version}
main: fr.openmc.core.OMCPlugin
api-version: '1.21.4'

Expand Down
Loading