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
28 changes: 28 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish Multification Release
on:
release:
branches: [ master ]
types: [ published ]
jobs:
publish:
runs-on: ubuntu-latest
environment: deployment
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
cache: 'gradle'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Publish with Gradle
run: ./gradlew publish
env:
ETERNAL_CODE_MAVEN_USERNAME: ${{ secrets.ETERNAL_CODE_MAVEN_USERNAME }}
ETERNAL_CODE_MAVEN_PASSWORD: ${{ secrets.ETERNAL_CODE_MAVEN_PASSWORD }}
27 changes: 27 additions & 0 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish Multification Snapshot
on:
push:
branches: [ master ]
jobs:
publish:
runs-on: ubuntu-latest
environment: deployment
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
cache: 'gradle'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Publish with Gradle
run: ./gradlew publish
env:
ETERNAL_CODE_MAVEN_USERNAME: ${{ secrets.ETERNAL_CODE_MAVEN_USERNAME }}
ETERNAL_CODE_MAVEN_PASSWORD: ${{ secrets.ETERNAL_CODE_MAVEN_PASSWORD }}
67 changes: 12 additions & 55 deletions buildSrc/src/main/kotlin/multification-publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,66 +15,23 @@ publishing {
repositories {
mavenLocal()

maven(
name = "eternalcode",
url = "https://repo.eternalcode.pl",
username = "ETERNAL_CODE_MAVEN_USERNAME",
password = "ETERNAL_CODE_MAVEN_PASSWORD",
snapshots = true,
beta = true,
)
}
}

fun RepositoryHandler.maven(
name: String,
url: String,
username: String,
password: String,
snapshots: Boolean = true,
beta: Boolean = false
) {
val isSnapshot = version.toString().endsWith("-SNAPSHOT")

if (isSnapshot && !snapshots) {
return
}

val isBeta = version.toString().contains("-BETA")

if (isBeta && !beta) {
return
}
maven {
url = uri("https://repo.eternalcode.pl/releases")

this.maven {
this.name =
if (isSnapshot) "${name}Snapshots"
else "${name}Releases"

this.url =
if (isSnapshot) uri("$url/snapshots")
else uri("$url/releases")
if (version.toString().endsWith("-SNAPSHOT")) {
url = uri("https://repo.eternalcode.pl/snapshots")
}

this.credentials {
this.username = System.getenv(username)
this.password = System.getenv(password)
credentials {
username = System.getenv("ETERNAL_CODE_MAVEN_USERNAME")
password = System.getenv("ETERNAL_CODE_MAVEN_PASSWORD")
}
}
}
}

interface MultificationPublishExtension {
var artifactId: String
}

val extension = extensions.create<MultificationPublishExtension>("multificationPublish")

afterEvaluate {
publishing {
publications {
create<MavenPublication>("maven") {
artifactId = extension.artifactId
from(project.components["java"])
}
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
}
4 changes: 0 additions & 4 deletions multification-cdn/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,3 @@ dependencies {
api("net.dzikoysk:cdn:1.14.4")
api("dev.rollczi:litecommands-core:3.2.2")
}

multificationPublish {
artifactId = "multification-cdn"
}
4 changes: 0 additions & 4 deletions multification-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,4 @@ plugins {
dependencies {
api("net.kyori:adventure-api:4.14.0")
api("org.jetbrains:annotations:24.0.1")
}

multificationPublish {
artifactId = "multification-core"
}