diff --git a/.github/monorepo.json b/.github/monorepo.json new file mode 100644 index 00000000..36313cce --- /dev/null +++ b/.github/monorepo.json @@ -0,0 +1,8 @@ +{ + "projects": { + "./hideout-activitypub": "hideout-activitypub", + "./hideout-core": "hideout-core", + "./hideout-mastodon": "hideout-mastodon", + "./owl": "owl" + } +} \ No newline at end of file diff --git a/.github/workflows/master-publish-package.yaml b/.github/workflows/master-publish-package.yaml new file mode 100644 index 00000000..36abce0e --- /dev/null +++ b/.github/workflows/master-publish-package.yaml @@ -0,0 +1,78 @@ +name: master-publish-package.yaml +on: + pull_request: + branches: + - "master" + - "release-test-master" +jobs: + release-diff-check: + name: Release diff check + runs-on: ubuntu-latest + outputs: + diff: ${{ steps.check-diff.outputs.result }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: fetch git + run: git fetch --depth 1 origin + + - name: Check diff + id: check-diff + uses: actions/github-script@v3 + with: + result-encoding: 'json' + script: | + const fs = require('fs') + const {execSync} = require('child_process'); + const jsonData = JSON.parse(fs.readFileSync('./.github/monorepo.json', 'utf8')); + const baseRef = context.payload.pull_request.base.ref + console.log(baseRef) + var tags = [] + + for (let [key, value] of Object.entries(jsonData.projects)) { + console.log(execSync("git branch", {encoding: 'utf8'})) + const command = "git diff origin/" + baseRef + " -- HEAD --name-only --relative=" + key + "\n"; + const output = execSync(command, {encoding: 'utf8'}); + console.log(output) + if (output.trim() === '') { + tags.push(value) + } + } + return tags + + - name: show diff + env: + DIFF: ${{ steps.check-diff.outputs.result }} + run: echo "$DIFF" + + publish-package: + runs-on: ubuntu-latest + needs: release-diff-check + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Gradle Wrapper Validation + uses: gradle/actions/wrapper-validation@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + with: + cache-read-only: false + gradle-home-cache-cleanup: true + + - name: Publish OWL Local + if: ${{ github.base_ref == 'release-test-master' && contains( needs.release-diff-check.outputs.diff, 'owl') }} + run: ./owl/gradlew :owl:publishMavenPublicationToMavenLocal + + - name: Publish OWL Gitea + + if: ${{ github.base_ref == 'master' && contains( needs.release-diff-check.outputs.diff , 'owl')}} + run: ./owl/gradlew :owl:publishMavenPublicationToGiteaRepository \ No newline at end of file diff --git a/.github/workflows/pull-request-merge-check.yml b/.github/workflows/pull-request-merge-check.yml index 28b4cda4..71055387 100644 --- a/.github/workflows/pull-request-merge-check.yml +++ b/.github/workflows/pull-request-merge-check.yml @@ -2,6 +2,8 @@ name: PullRequest Merge Check on: pull_request: + paths-ignore: + - 'owl/**' branches: - "develop" types: diff --git a/gradle.properties b/gradle.properties index 0c1ed385..29326c5e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,4 @@ org.gradle.parallel=true org.gradle.configureondemand=true org.gradle.caching=true -org.gradle.jvmargs=-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC --add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED -XX:TieredStopAtLevel=1 -noverify -org.gradle.configuration-cache=true -org.gradle.configuration-cache.problems=warn \ No newline at end of file +org.gradle.jvmargs=-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC --add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED -XX:TieredStopAtLevel=1 -noverify \ No newline at end of file diff --git a/hideout-core/build.gradle.kts b/hideout-core/build.gradle.kts index 0ef80aa8..2739b00b 100644 --- a/hideout-core/build.gradle.kts +++ b/hideout-core/build.gradle.kts @@ -12,7 +12,6 @@ plugins { alias(libs.plugins.kotlin.spring) alias(libs.plugins.kover) alias(libs.plugins.license.report) - } apply { @@ -82,8 +81,8 @@ dependencies { implementation(libs.bundles.ktor.client) implementation(libs.bundles.apache.tika) implementation(libs.bundles.openapi) - implementation(libs.bundles.owl.producer) - implementation(libs.bundles.owl.broker) +// implementation(libs.bundles.owl.producer) +// implementation(libs.bundles.owl.broker) implementation(libs.bundles.spring.boot.oauth2) implementation(libs.bundles.spring.boot.data.mongodb) implementation("org.springframework.boot:spring-boot-starter-actuator") @@ -104,7 +103,7 @@ dependencies { implementation(libs.flyway.core) runtimeOnly(libs.flyway.postgresql) - implementation("dev.usbharu:owl-common-serialize-jackson:0.0.1") +// implementation("dev.usbharu:owl-common-serialize-jackson:0.0.1") implementation(libs.javacv) { exclude(module = "opencv") diff --git a/owl/build.gradle.kts b/owl/build.gradle.kts index 94bf8763..1bc1d780 100644 --- a/owl/build.gradle.kts +++ b/owl/build.gradle.kts @@ -1,5 +1,6 @@ plugins { alias(libs.plugins.kotlin.jvm) + id("maven-publish") } @@ -13,9 +14,19 @@ allprojects { } } +tasks { + create("publishMavenPublicationToMavenLocal") { + subprojects.forEach { dependsOn("${it.path}:publishMavenPublicationToMavenLocal") } + } + create("publishMavenPublicationToGiteaRepository") { + subprojects.forEach { dependsOn("${it.path}:publishMavenPublicationToGiteaRepository") } + } +} + subprojects { apply { plugin("org.jetbrains.kotlin.jvm") + plugin("maven-publish") } kotlin { jvmToolchain(21) @@ -28,10 +39,34 @@ subprojects { } - tasks.test { useJUnitPlatform() } + publishing { + repositories { + maven { + name = "Gitea" + url = uri("https://git.usbharu.dev/api/packages/usbharu/maven") + credentials(HttpHeaderCredentials::class) { + name = "Authorization" + value = "token " + (project.findProperty("gpr.gitea") as String? ?: System.getenv("GITEA")) + } + + authentication { + create("header") + } + } + } + + publications { + register("maven") { + groupId = "dev.usbharu" + artifactId = project.name + version = project.version.toString() + from(components["kotlin"]) + } + } + } } \ No newline at end of file diff --git a/owl/gradle.properties b/owl/gradle.properties index 1108ef87..43cbcbb4 100644 --- a/owl/gradle.properties +++ b/owl/gradle.properties @@ -1,7 +1,4 @@ kotlin.code.style=official org.gradle.daemon=true org.gradle.parallel=true -org.gradle.configureondemand=true -#ksp.useKSP2=true -org.gradle.configuration-cache=true -org.gradle.configuration-cache.problems=warn \ No newline at end of file +org.gradle.configureondemand=true \ No newline at end of file diff --git a/owl/gradlew b/owl/gradlew old mode 100644 new mode 100755