Skip to content

Commit e326924

Browse files
authored
Merge pull request #14 from MauroDataMapper-Plugins/feature/publishAllPublicationsToMauroSnapshot
Publish All Publications To Mauro Snapshots
2 parents ae0115f + f8a5921 commit e326924

4 files changed

Lines changed: 111 additions & 11 deletions

File tree

.github/workflows/gradle.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: gradle.yml
2+
on:
3+
push:
4+
branches: [ "**" ]
5+
pull_request:
6+
branches: [ "**" ]
7+
permissions:
8+
contents: read
9+
actions: read
10+
checks: write
11+
security-events: write
12+
13+
jobs:
14+
build:
15+
permissions: write-all
16+
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up JDK 17
22+
uses: actions/setup-java@v4
23+
with:
24+
java-version: '17'
25+
distribution: 'temurin'
26+
- name: Setup Gradle
27+
uses: gradle/actions/setup-gradle@v3
28+
with:
29+
cache-disabled: true
30+
31+
- name: Log Gradle version
32+
run: ./gradlew --version
33+
34+
- name: Publish Snapshot to Mauro Snapshot Repository
35+
if: success() && github.ref == 'refs/heads/main'
36+
env:
37+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_IN_MEMORY_KEY }}
38+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_IN_MEMORY_KEY_PASSWORD }}
39+
run: |
40+
./gradlew --stacktrace -PMauroSnapshotRepositoryUsername=${{secrets.MAURO_SNAPSHOT_REPOSITORY_USERNAME}} -PMauroSnapshotRepositoryPassword=${{secrets.MAURO_SNAPSHOT_REPOSITORY_PASSWORD}} publishAllPublicationsToMauroSnapshotRepositoryRepository
41+
- name: Send a stream message
42+
if: success() || failure()
43+
uses: zulip/github-actions-zulip/send-message@v1
44+
with:
45+
api-key: ${{ secrets.ZULIP_API_KEY }}
46+
email: "githubactionsbot-bot@maurodatamapper.zulipchat.com"
47+
organization-url: "https://maurodatamapper.zulipchat.com"
48+
to: "build/github-actions"
49+
type: "stream"
50+
topic: "${{github.repository}}"
51+
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 }}"

build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
tasks.register("publishAllToMavenLocal") {
3+
dependsOn(
4+
":plugin:publishToMavenLocal",
5+
":cli:publishToMavenLocal"
6+
)
7+
}
8+
9+
tasks.register("publishAllPublicationsToMauroSnapshotRepositoryRepository") {
10+
dependsOn(
11+
":plugin:publishAllPublicationsToMauroSnapshotRepositoryRepository",
12+
":cli:publishAllPublicationsToMauroSnapshotRepositoryRepository"
13+
)
14+
}

cli/build.gradle

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ plugins {
22
id("groovy")
33
id("io.micronaut.application") version "4.6.1"
44
id("io.micronaut.aot") version "4.6.1"
5+
id("com.gradleup.shadow") version "8.3.6"
56
id("maven-publish")
67
}
78

9+
group = 'org.maurodata.plugins'
10+
version = '0.0.1-SNAPSHOT'
11+
812
repositories {
913
mavenLocal()
1014
mavenCentral()
@@ -65,3 +69,25 @@ tasks.named("run", JavaExec) {
6569
tasks.withType(Jar).configureEach {
6670
archiveBaseName.set(rootProject.name+'-cli')
6771
}
72+
73+
plugins.withId("maven-publish") {
74+
publishing {
75+
publications {
76+
create("mavenJava", MavenPublication) {
77+
from(components["java"])
78+
artifactId = "${rootProject.name}-cli"
79+
}
80+
}
81+
82+
repositories {
83+
maven {
84+
name = "MauroSnapshotRepository"
85+
url = "https://mauro-repository.com/libs-snapshot-local"
86+
credentials(PasswordCredentials)
87+
authentication {
88+
basic(BasicAuthentication)
89+
}
90+
}
91+
}
92+
}
93+
}

plugin/build.gradle

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id("groovy")
33
id("io.micronaut.library") version "4.6.1"
44
id("io.micronaut.aot") version "4.6.1"
5+
id("com.gradleup.shadow") version "8.3.6"
56
id("maven-publish")
67
}
78

@@ -76,22 +77,30 @@ java {
7677
targetCompatibility = JavaVersion.toVersion("17")
7778
}
7879

80+
// Publish to the Mauro Snapshot Repository
81+
7982
tasks.withType(Jar).configureEach {
8083
archiveBaseName.set(rootProject.name)
8184
}
8285

83-
// TODO: Uncomment this to publish to the Mauro Snapshot Repository
84-
/*
85-
publishing {
86-
repositories {
87-
maven {
88-
name = "MauroSnapshotRepository"
89-
url = "https://mauro-repository.com/libs-snapshot-local"
90-
credentials(PasswordCredentials)
91-
authentication {
92-
basic(BasicAuthentication)
86+
plugins.withId("maven-publish") {
87+
publishing {
88+
publications {
89+
create("mavenJava", MavenPublication) {
90+
from(components["java"])
91+
artifactId = "${rootProject.name}"
92+
}
93+
}
94+
95+
repositories {
96+
maven {
97+
name = "MauroSnapshotRepository"
98+
url = "https://mauro-repository.com/libs-snapshot-local"
99+
credentials(PasswordCredentials)
100+
authentication {
101+
basic(BasicAuthentication)
102+
}
93103
}
94104
}
95105
}
96106
}
97-
*/

0 commit comments

Comments
 (0)