From a636f393e896311cfccdf991d76b15c1d2c54cf8 Mon Sep 17 00:00:00 2001 From: "Lukas Rieger (Blue)" Date: Thu, 4 Apr 2024 02:41:32 +0200 Subject: [PATCH] Publish to BlueColored repo --- .github/workflows/publish.yml | 25 +++++++++++++++++++++++++ bluecommands-brigadier/build.gradle.kts | 22 +++++++++++++++++++++- bluecommands-core/build.gradle.kts | 14 ++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..6ee7a65 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,25 @@ +name: Java CI + +on: + workflow_dispatch: + push: + tags: + - "**" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 # needed for versioning + - name: Set up Java 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Build with Gradle + run: ./gradlew clean publish + env: + BLUECOLORED_USERNAME: ${{ secrets.BLUECOLORED_USERNAME }} + BLUECOLORED_PASSWORD: ${{ secrets.BLUECOLORED_PASSWORD }} \ No newline at end of file diff --git a/bluecommands-brigadier/build.gradle.kts b/bluecommands-brigadier/build.gradle.kts index 5f5c91e..fa13d75 100644 --- a/bluecommands-brigadier/build.gradle.kts +++ b/bluecommands-brigadier/build.gradle.kts @@ -60,7 +60,7 @@ repositories { } dependencies { - implementation ( project(":bluecommands-core") ) + api ( project(":bluecommands-core") ) implementation ("com.mojang:brigadier:1.0.17") compileOnly ("org.jetbrains:annotations:24.0.1") @@ -114,6 +114,20 @@ tasks.javadoc { } publishing { + repositories { + maven { + name = "bluecolored" + + val releasesRepoUrl = "https://repo.bluecolored.de/releases" + val snapshotsRepoUrl = "https://repo.bluecolored.de/snapshots" + url = uri(if (version == lastVersion) releasesRepoUrl else snapshotsRepoUrl) + + credentials { + username = project.findProperty("bluecoloredUsername") as String? ?: System.getenv("BLUECOLORED_USERNAME") + password = project.findProperty("bluecoloredPassword") as String? ?: System.getenv("BLUECOLORED_PASSWORD") + } + } + } publications { create("maven") { groupId = project.group.toString() @@ -121,6 +135,12 @@ publishing { version = project.version.toString() from(components["java"]) + + versionMapping { + usage("java-api") { + fromResolutionOf("runtimeClasspath") + } + } } } } diff --git a/bluecommands-core/build.gradle.kts b/bluecommands-core/build.gradle.kts index a89c32a..8150932 100644 --- a/bluecommands-core/build.gradle.kts +++ b/bluecommands-core/build.gradle.kts @@ -108,6 +108,20 @@ tasks.javadoc { } publishing { + repositories { + maven { + name = "bluecolored" + + val releasesRepoUrl = "https://repo.bluecolored.de/releases" + val snapshotsRepoUrl = "https://repo.bluecolored.de/snapshots" + url = uri(if (version == lastVersion) releasesRepoUrl else snapshotsRepoUrl) + + credentials { + username = project.findProperty("bluecoloredUsername") as String? ?: System.getenv("BLUECOLORED_USERNAME") + password = project.findProperty("bluecoloredPassword") as String? ?: System.getenv("BLUECOLORED_PASSWORD") + } + } + } publications { create("maven") { groupId = project.group.toString()