diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..302e245 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,33 @@ +name: Build and Format Check + +on: + pull_request: + branches: ["main"] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: "17" + distribution: "temurin" + + - name: Set up Maven + uses: stCarolas/setup-maven@v4.5 + with: + maven-version: "3.9.5" + + - name: Cache Maven packages + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Build & Format Check with Maven + run: mvn -B verify \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..49db933 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: Release Plugin + +on: + push: + tags: + - "v*.*.*" + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: "17" + distribution: "temurin" + + - name: Cache Maven packages + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Build with Maven + run: mvn -B package -DskipTests + + - name: Create Release and Upload Artifact + uses: softprops/action-gh-release@v1 + with: + generate_release_notes: true + files: target/*.jar \ No newline at end of file diff --git a/pom.xml b/pom.xml index 9db6d42..1340aec 100644 --- a/pom.xml +++ b/pom.xml @@ -57,11 +57,28 @@ org.apache.maven.plugins maven-compiler-plugin + 3.11.0 ${java.version} ${java.version} + + + com.github.gantsign.maven + ktlint-maven-plugin + 3.5.0 + + + format-and-check + process-sources + + format + check + + + + \ No newline at end of file diff --git a/src/main/kotlin/com/pool25m/logtime/LogTimePlugin.kt b/src/main/kotlin/com/pool25m/logtime/LogTimePlugin.kt index e798c81..e53fa91 100644 --- a/src/main/kotlin/com/pool25m/logtime/LogTimePlugin.kt +++ b/src/main/kotlin/com/pool25m/logtime/LogTimePlugin.kt @@ -12,4 +12,4 @@ class LogTimePlugin : JavaPlugin() { override fun onDisable() { logger.info("LogTime Plugin has been disabled.") } -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/pool25m/logtime/RankingCommand.kt b/src/main/kotlin/com/pool25m/logtime/RankingCommand.kt index d1ff784..b942fd7 100644 --- a/src/main/kotlin/com/pool25m/logtime/RankingCommand.kt +++ b/src/main/kotlin/com/pool25m/logtime/RankingCommand.kt @@ -5,9 +5,14 @@ import org.bukkit.command.CommandExecutor import org.bukkit.command.CommandSender class RankingCommand : CommandExecutor { - override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array): Boolean { + override fun onCommand( + sender: CommandSender, + command: Command, + label: String, + args: Array, + ): Boolean { sender.sendMessage("LogTime plugin is working!") - + return true } -} \ No newline at end of file +}