Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle #2

Merged
merged 5 commits into from
Jul 6, 2024
Merged
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
64 changes: 64 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Gradle CI

on:
workflow_dispatch:
push:
pull_request:
release:
types: [created, prereleased]

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- name: Checkout Movecraft-ShipRules
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"

- name: Build with Gradle
run: ./gradlew clean build --parallel

- name: Publish to GitHub Packages
if: ${{ github.event_name == 'release' }}
run: ./gradlew publish --parallel
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to PaperMC Hangar
if: ${{ github.event_name == 'release' }}
run: ./gradlew publishPluginPublicationToHangar --parallel
env:
HANGAR_API_TOKEN: ${{ secrets.HANGAR_API_TOKEN }}

- name: Stage jar for Actions
if: ${{ github.event_name != 'release' }}
run: mkdir staging && cp build/libs/Movecraft-ShipRules.jar staging && mv staging/Movecraft-ShipRules.jar staging/Movecraft-ShipRules_$GITHUB_SHA.jar
- name: Upload jar to Actions
if: ${{ github.event_name != 'release' }}
uses: actions/upload-artifact@v4
with:
name: Movecraft-ShipRules_Dev-Build
path: staging/Movecraft-ShipRules_*.jar

- name: Stage jar for Release
if: ${{ github.event_name == 'release' }}
run: mkdir staging && cp build/libs/Movecraft-ShipRules.jar staging && mv staging/Movecraft-ShipRules.jar staging/Movecraft-ShipRules_${{ github.event.release.tag_name }}.jar
- name: Upload jar to Release
if: ${{ github.event_name == 'release' }}
uses: softprops/action-gh-release@v2
with:
files: staging/Movecraft-ShipRules_${{ github.event.release.tag_name }}.jar
40 changes: 0 additions & 40 deletions .github/workflows/maven.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,26 @@ hs_err_pid*
*.iml
target/*
.vscode*

### GitHub example for gradle
.gradle
**/build/
!src/**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties

# Cache of project
.gradletasknamecache

# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Movecraft-ShipRules
A Spigot plugin designed to automatically enforce ship rules on Movecraft servers. Written by a4bde but borrows code heavily from Movecraft 8, written by cccm5, TylerS1066, and BaccaYarro.
A Paper plugin designed to automatically enforce ship rules on Movecraft servers. Written by a4bde but borrows code heavily from Movecraft 8, written by cccm5, TylerS1066, and BaccaYarro.

# Building
Movecraft-ShipRules requires Movecraft 8 to build. Its directory should be placed in the same directory as the directory containing Movecraft, and then `mvn clean install` can be run to build the plugin. Jars will be located in `Movecraft-ShipRules/target`.
`./gradlew clean build --parallel` can be run to build the plugin. Jars will be located in `Movecraft-ShipRules/build/libs`.

# Usage
Movecraft-ShipRules adds the following craft type properties:
Expand Down
60 changes: 60 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
plugins {
`java-library`
`maven-publish`
id("io.github.0ffz.github-packages") version "1.2.1"
id("io.papermc.hangar-publish-plugin") version "0.1.2"
}

repositories {
gradlePluginPortal()
mavenLocal()
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/")
maven { githubPackage("apdevteam/movecraft")(this) }
}

dependencies {
api("org.jetbrains:annotations-java5:24.1.0")
compileOnly("io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT")
compileOnly("net.countercraft:movecraft:+")
}

group = "net.countercraft"
version = "1.0.0-beta-1_gradle"
description = "Movecraft-ShipRules"
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

tasks.jar {
archiveBaseName.set("Movecraft-ShipRules")
archiveClassifier.set("")
archiveVersion.set("")
}

tasks.processResources {
from(rootProject.file("LICENSE.md"))
filesMatching("*.yml") {
expand(mapOf("projectVersion" to project.version))
}
}

publishing {
publications {
create<MavenPublication>("maven") {
groupId = "net.countercraft.movecraft.rules"
artifactId = "movecraft-shiprules"
version = "${project.version}"

artifact(tasks.jar)
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/apdevteam/movecraft-shiprules")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading