Skip to content
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
60 changes: 60 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Deploy to Negative Games Nexus (Gradle)

on:
push:
branches:
- release
- snapshot

jobs:
deploy:
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: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Configure Gradle / Nexus credentials
run: |
mkdir -p ~/.gradle
cat << 'EOF' > ~/.gradle/gradle.properties
nexusUsername=${{ secrets.NEXUS_USERNAME }}
nexusPassword=${{ secrets.NEXUS_PASSWORD }}
nexusSnapshotsUrl=https://repo.negative.games/repository/maven-snapshots
nexusReleasesUrl=https://repo.negative.games/repository/maven-releases
EOF

# Modify version for release branch (remove -SNAPSHOT)
- name: Modify version for release
if: github.ref == 'refs/heads/release'
run: |
find . -name "build.gradle.kts" -type f -exec sed -i "s/\\(var apiVersion = \\\"[^\\\"]*\\)-SNAPSHOT\\\"/\\1\\\"/" {} +

# Modify version for snapshot branch (add -SNAPSHOT if not present)
- name: Modify version for snapshot
if: github.ref == 'refs/heads/snapshot'
run: |
find . -name "build.gradle.kts" -type f -exec sed -i "/var apiVersion = \\\".*-SNAPSHOT\\\"/! s/\\(var apiVersion = \\\"[^\\\"]*\\)\\\"/\\1-SNAPSHOT\\\"/" {} +

# Make gradlew executable
- name: Make gradlew executable
run: chmod +x ./gradlew

# Deploy to RELEASES on release branch
- name: Build and deploy release
if: github.ref == 'refs/heads/release'
run: ./gradlew clean publish -PisRelease=true

# Deploy to SNAPSHOTS on snapshot branch
- name: Build and deploy snapshot
if: github.ref == 'refs/heads/snapshot'
run: ./gradlew clean publish -PisRelease=false
25 changes: 25 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id("java")
id("maven-publish")
}

subprojects {
Expand All @@ -23,3 +24,27 @@ subprojects {
tasks.withType<Jar>() {
enabled = false
}


subprojects {
plugins.withId("maven-publish") {
configure<PublishingExtension> {
repositories {
maven {
name = "nexus"

val snapshotsUrl = findProperty("nexusSnapshotsUrl") as String? ?: "https://repo.negative.games/repository/maven-snapshots"
val releasesUrl = findProperty("nexusReleasesUrl") as String? ?: "https://repo.negative.games/repository/maven-releases"

val isRelease = (findProperty("isRelease") == "true")
url = uri(if (isRelease) releasesUrl else snapshotsUrl)

credentials {
username = findProperty("nexusUsername") as String?
password = findProperty("nexusPassword") as String?
}
}
}
}
}
}
52 changes: 52 additions & 0 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
plugins {
id("java")
id("maven-publish")
id("com.gradleup.shadow") version("9.2.2")
}

var id = "plugin-engine-common"
var domain = "games.negative.engine"
var apiVersion = "1.0.0"

repositories {
mavenCentral()
}
Expand Down Expand Up @@ -33,4 +39,50 @@ dependencies {
// Lombok
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}

tasks.shadowJar {
archiveBaseName.set(id)
archiveVersion.set(apiVersion)
archiveClassifier.set("")
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
artifact(tasks.shadowJar) {
builtBy(tasks.shadowJar)
}

groupId = domain
artifactId = id
version = apiVersion

pom {
name.set(id)
description.set(project.description)
url.set("https://github.com/negative-games/plugin-engine")

licenses {
license {
name.set("The MIT License")
url.set("https://opensource.org/licenses/MIT")
}
}

developers {
developer {
id.set("ericlmao")
name.set("Eric")
}
}
}
}
}
}
56 changes: 56 additions & 0 deletions paper/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
plugins {
id("java")
id("maven-publish")
id("com.gradleup.shadow") version("9.2.2")
}

var id = "plugin-engine-paper"
var domain = "games.negative.engine"
var apiVersion = "1.0.0"

repositories {
mavenCentral()
}
Expand Down Expand Up @@ -33,4 +39,54 @@ dependencies {
// Lombok
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}

tasks.jar {
enabled = false
}

tasks.shadowJar {
archiveBaseName.set(id)
archiveVersion.set(apiVersion)
archiveClassifier.set("")
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
artifact(tasks.shadowJar) {
builtBy(tasks.shadowJar)
}

groupId = domain
artifactId = id
version = apiVersion

pom {
name.set(id)
description.set(project.description)
url.set("https://github.com/negative-games/plugin-engine")

licenses {
license {
name.set("The MIT License")
url.set("https://opensource.org/licenses/MIT")
}
}

developers {
developer {
id.set("ericlmao")
name.set("Eric")
}
}
}
}
}
}
Loading