diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 503df0d..d0a2501 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,17 +11,16 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 - + - name: Setup Java JDK - uses: actions/setup-java@v3 + uses: graalvm/setup-graalvm@v1 with: - java-version: 21 - distribution: 'zulu' - cache: 'gradle' - + java-version: '21' + distribution: 'graalvm' + - name: Make gradlew executable run: chmod +x gradlew - + - name: Build with Gradle run: ./gradlew shadowJar @@ -32,6 +31,11 @@ jobs: - name: Get Repository Name uses: MariachiBear/get-repo-name-action@v1.1.0 + - name: Publish to GitHub Packages + run: ./gradlew publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/upload-artifact@v4.5.0 with: name: ${{ steps.repo-name.outputs.repository-name }} ${{ steps.short_sha.outputs.sha_short }} -annotation @@ -40,20 +44,20 @@ jobs: - uses: actions/upload-artifact@v4.5.0 with: name: ${{ steps.repo-name.outputs.repository-name }} ${{ steps.short_sha.outputs.sha_short }} -cache - path: | + path: | cache/build/libs/*.jar - uses: actions/upload-artifact@v4.5.0 with: name: ${{ steps.repo-name.outputs.repository-name }} ${{ steps.short_sha.outputs.sha_short }} -configuration - path: | + path: | configuration/build/libs/*.jar - uses: actions/upload-artifact@v4.5.0 with: name: ${{ steps.repo-name.outputs.repository-name }} ${{ steps.short_sha.outputs.sha_short }} -commons - path: | + path: | commons/build/libs/*.jar - uses: actions/upload-artifact@v4.5.0 with: name: ${{ steps.repo-name.outputs.repository-name }} ${{ steps.short_sha.outputs.sha_short }} -mongodb - path: | + path: | mongodb/build/libs/*.jar diff --git a/build.gradle.kts b/build.gradle.kts index f1ad7fb..5ee162c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,6 +4,7 @@ fun properties(key: String) = project.findProperty(key).toString() group = properties("group") version = properties("version") +val modules = rootProject.subprojects.map { it.name } plugins { // Java plugin @@ -23,6 +24,9 @@ plugins { // Lombok id("io.freefair.lombok") version "8.11" apply false + + // Maven publish + id("maven-publish") } subprojects { @@ -89,4 +93,27 @@ subprojects { relocate("io.github.retrooper.packetevents", "io.fairyproject.libs.packetevents") relocate("io.fairyproject.bukkit.menu", "${properties("package")}.fairy.menu") } -} \ No newline at end of file +} + +publishing { + publications { + modules.forEach { module -> + create("maven-${module.capitalize()}") { + from(components["java"]) + groupId = group.toString() + artifactId = "$module" + version = version + } + } + } + // GitHub Packages + repositories { + maven { + url = uri("https://maven.pkg.github.com/LegacyLands/legacy-lands-library") + credentials { + username = project.findProperty("githubUsername")?.toString() ?: System.getenv("GITHUB_USERNAME")?.toString() ?: error("GitHub username is missing") + password = project.findProperty("githubToken")?.toString() ?: System.getenv("GITHUB_TOKEN")?.toString() ?: error("GitHub token is missing") + } + } + } +} diff --git a/legacy-lands-library b/legacy-lands-library new file mode 160000 index 0000000..80a0d4a --- /dev/null +++ b/legacy-lands-library @@ -0,0 +1 @@ +Subproject commit 80a0d4a3d4e6e8b861b94560ba1b31df174ad421