From 9f5ed7972503a1654871423e8050743b81c3526c Mon Sep 17 00:00:00 2001 From: edcrichton Date: Mon, 2 Mar 2026 11:45:55 +0000 Subject: [PATCH 1/2] Publish All Publications To Mauro Snapshots There are two sub projects. Add a top level project build and ask it to depend on the sub projects --- .github/workflows/gradle.yml | 40 ++++++++++++++++++++++++++++++++++++ build.gradle | 14 +++++++++++++ cli/build.gradle | 26 +++++++++++++++++++++++ plugin/build.gradle | 31 ++++++++++++++++++---------- 4 files changed, 100 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/gradle.yml create mode 100644 build.gradle diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..7bf1b7b --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,40 @@ +name: gradle.yml +on: + push: + branches: [ "**" ] + pull_request: + branches: [ "**" ] +permissions: + contents: read + actions: read + checks: write + security-events: write + +jobs: + build: + permissions: write-all + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + cache-disabled: true + + - name: Log Gradle version + run: ./gradlew --version + + - name: Publish Snapshot to Mauro Snapshot Repository + if: success() && github.ref == 'refs/heads/main' + env: + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_IN_MEMORY_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_IN_MEMORY_KEY_PASSWORD }} + run: | + ./gradlew --stacktrace -PMauroSnapshotRepositoryUsername=${{secrets.MAURO_SNAPSHOT_REPOSITORY_USERNAME}} -PMauroSnapshotRepositoryPassword=${{secrets.MAURO_SNAPSHOT_REPOSITORY_PASSWORD}} publishAllPublicationsToMauroSnapshotRepositoryRepository diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..1fd5ba5 --- /dev/null +++ b/build.gradle @@ -0,0 +1,14 @@ + +tasks.register("publishAllToMavenLocal") { + dependsOn( + ":plugin:publishToMavenLocal", + ":cli:publishToMavenLocal" + ) +} + +tasks.register("publishAllPublicationsToMauroSnapshotRepositoryRepository") { + dependsOn( + ":plugin:publishAllPublicationsToMauroSnapshotRepositoryRepository", + ":cli:publishAllPublicationsToMauroSnapshotRepositoryRepository" + ) +} diff --git a/cli/build.gradle b/cli/build.gradle index 9b1f078..0091f2d 100644 --- a/cli/build.gradle +++ b/cli/build.gradle @@ -2,9 +2,13 @@ plugins { id("groovy") id("io.micronaut.application") version "4.6.1" id("io.micronaut.aot") version "4.6.1" + id("com.gradleup.shadow") version "8.3.6" id("maven-publish") } +group = 'org.maurodata.plugins' +version = '0.0.1-SNAPSHOT' + repositories { mavenLocal() mavenCentral() @@ -65,3 +69,25 @@ tasks.named("run", JavaExec) { tasks.withType(Jar).configureEach { archiveBaseName.set(rootProject.name+'-cli') } + +plugins.withId("maven-publish") { + publishing { + publications { + create("mavenJava", MavenPublication) { + from(components["java"]) + artifactId = "${rootProject.name}-cli" + } + } + + repositories { + maven { + name = "MauroSnapshotRepository" + url = "https://mauro-repository.com/libs-snapshot-local" + credentials(PasswordCredentials) + authentication { + basic(BasicAuthentication) + } + } + } + } +} \ No newline at end of file diff --git a/plugin/build.gradle b/plugin/build.gradle index b15947c..b806e93 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -2,6 +2,7 @@ plugins { id("groovy") id("io.micronaut.library") version "4.6.1" id("io.micronaut.aot") version "4.6.1" + id("com.gradleup.shadow") version "8.3.6" id("maven-publish") } @@ -76,22 +77,30 @@ java { targetCompatibility = JavaVersion.toVersion("17") } +// Publish to the Mauro Snapshot Repository + tasks.withType(Jar).configureEach { archiveBaseName.set(rootProject.name) } -// TODO: Uncomment this to publish to the Mauro Snapshot Repository -/* -publishing { - repositories { - maven { - name = "MauroSnapshotRepository" - url = "https://mauro-repository.com/libs-snapshot-local" - credentials(PasswordCredentials) - authentication { - basic(BasicAuthentication) +plugins.withId("maven-publish") { + publishing { + publications { + create("mavenJava", MavenPublication) { + from(components["java"]) + artifactId = "${rootProject.name}" + } + } + + repositories { + maven { + name = "MauroSnapshotRepository" + url = "https://mauro-repository.com/libs-snapshot-local" + credentials(PasswordCredentials) + authentication { + basic(BasicAuthentication) + } } } } } -*/ \ No newline at end of file From f8a59219e150a3b439ef7890cd29918155779609 Mon Sep 17 00:00:00 2001 From: edcrichton Date: Mon, 2 Mar 2026 13:16:13 +0000 Subject: [PATCH 2/2] Adds zulip notification step --- .github/workflows/gradle.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 7bf1b7b..1a23363 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -38,3 +38,14 @@ jobs: ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_IN_MEMORY_KEY_PASSWORD }} run: | ./gradlew --stacktrace -PMauroSnapshotRepositoryUsername=${{secrets.MAURO_SNAPSHOT_REPOSITORY_USERNAME}} -PMauroSnapshotRepositoryPassword=${{secrets.MAURO_SNAPSHOT_REPOSITORY_PASSWORD}} publishAllPublicationsToMauroSnapshotRepositoryRepository + - name: Send a stream message + if: success() || failure() + uses: zulip/github-actions-zulip/send-message@v1 + with: + api-key: ${{ secrets.ZULIP_API_KEY }} + email: "githubactionsbot-bot@maurodatamapper.zulipchat.com" + organization-url: "https://maurodatamapper.zulipchat.com" + to: "build/github-actions" + type: "stream" + topic: "${{github.repository}}" + content: "${{ job.status == 'success' && ':check_mark:' || ':cross_mark:' }} ${{github.repository}} : **${{github.ref}}**\nGitHub Actions build result: **${{ job.status }}**\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"