Skip to content

Commit d14f632

Browse files
jackblack369wt0530
authored andcommitted
[ci] Config publish package to maven central
1 parent 5842b77 commit d14f632

File tree

10 files changed

+272
-157
lines changed

10 files changed

+272
-157
lines changed

.github/workflows/publish.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Publish Package
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Build"]
6+
types:
7+
- completed
8+
on:
9+
branches:
10+
- main
11+
pull_requests:
12+
- merged
13+
14+
env:
15+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
16+
BUILD_TYPE: Release
17+
18+
jobs:
19+
build:
20+
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
packages: write
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
submodules: recursive
30+
31+
- name: Set up JDK 17
32+
uses: actions/setup-java@v4
33+
with:
34+
java-version: '17'
35+
distribution: 'temurin'
36+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
37+
settings-path: ${{ github.workspace }} # location for the settings.xml file
38+
39+
- name: Configure libexpr
40+
working-directory: ${{github.workspace}}/libexpr
41+
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=OFF
42+
43+
- name: Build libexpr
44+
working-directory: ${{github.workspace}}/libexpr
45+
run: cmake --build build --config ${{env.BUILD_TYPE}}
46+
47+
- name: Config jni
48+
working-directory: ${{github.workspace}}/jni/src/main/cpp
49+
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
50+
51+
- name: Build jni
52+
working-directory: ${{github.workspace}}/jni/src/main/cpp
53+
run: cmake --build build --config ${{env.BUILD_TYPE}}
54+
55+
# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
56+
# the publishing section of your build.gradle
57+
- name: Publish Packages to Maven Central
58+
run: ./gradlew publishToMavenCentral --stacktrace
59+
env:
60+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_USERNAME }}
61+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_PASSWORD }}
62+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
63+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
64+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}

annotations/build.gradle

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ plugins {
1818
id 'java-conventions'
1919
id 'java-library'
2020
id 'com.gorylenko.gradle-git-properties' version "${gradleGitPropertiesVersion}"
21-
id 'maven-publish'
2221
id "com.vanniktech.maven.publish"
2322
}
2423

@@ -51,23 +50,35 @@ afterEvaluate {
5150
}
5251

5352
mavenPublishing {
54-
coordinates(GROUP, "dingo-expr-annotations", VERSION)
55-
publishToMavenCentral()
56-
}
57-
58-
publishing {
59-
publications {
60-
annotations(MavenPublication) {
61-
artifactId = 'dingo-expr-annotations'
62-
from components.java
63-
pom {
64-
name = 'dingo-expr-annotations'
65-
description = 'Annotation processors for Dingo Expression.'
53+
coordinates(project.property("GROUP") as String, "dingo-expr-annotations", project.property("VERSION") as String)
54+
55+
pom {
56+
name = "dingo-expr-annotations"
57+
description = "Annotation processors for Dingo Expression."
58+
url= "https://www.dingodb.com/"
59+
60+
licenses {
61+
license {
62+
name = "The Apache License, Version 2.0"
63+
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
6664
}
67-
gradle.setPom(it)
65+
}
66+
67+
developers {
68+
developer {
69+
id = "dingodb"
70+
name = "DingoDB develop team"
71+
email = "dingodb@zetyun.com"
72+
}
73+
}
74+
75+
scm {
76+
connection = "scm:git:git://github.com/dingodb/dingo-expr.git"
77+
developerConnection = "scm:git:ssh://github.com/dingodb/dingo-expr.git"
78+
url = "https://github.com/dingodb/dingo-expr"
6879
}
6980
}
70-
repositories {
71-
gradle.setCentralRepo(it, project)
72-
}
81+
82+
publishToMavenCentral()
83+
signAllPublications()
7384
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
plugins {
18-
id "com.vanniktech.maven.publish" version "0.33.0" apply false
18+
id "com.vanniktech.maven.publish" version "0.34.0" apply false
1919
}
2020

2121
group GROUP

coding/build.gradle

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ plugins {
1818
id 'java-conventions'
1919
id 'java-library'
2020
id 'com.gorylenko.gradle-git-properties' version "${gradleGitPropertiesVersion}"
21-
id 'maven-publish'
2221
id "com.vanniktech.maven.publish"
2322
}
2423

@@ -48,28 +47,35 @@ afterEvaluate {
4847
}
4948

5049
mavenPublishing {
51-
coordinates(GROUP, "dingo-expr-coding", VERSION)
52-
publishToMavenCentral()
53-
54-
}
55-
56-
publishing {
57-
publications {
58-
coding(MavenPublication) {
59-
artifactId = 'dingo-expr-coding'
60-
from components.java
61-
pom {
62-
name = 'dingo-expr-coding'
63-
description = 'Coding library of Dingo Expression.'
50+
coordinates(project.property("GROUP") as String, "dingo-expr-coding", project.property("VERSION") as String)
51+
52+
pom {
53+
name = "dingo-expr-coding"
54+
description = "Coding library of Dingo Expression."
55+
url= "https://www.dingodb.com/"
56+
57+
licenses {
58+
license {
59+
name = "The Apache License, Version 2.0"
60+
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
6461
}
65-
gradle.setPom(it)
62+
}
63+
64+
developers {
65+
developer {
66+
id = "dingodb"
67+
name = "DingoDB develop team"
68+
email = "dingodb@zetyun.com"
69+
}
70+
}
71+
72+
scm {
73+
connection = "scm:git:git://github.com/dingodb/dingo-expr.git"
74+
developerConnection = "scm:git:ssh://github.com/dingodb/dingo-expr.git"
75+
url = "https://github.com/dingodb/dingo-expr"
6676
}
6777
}
68-
repositories {
69-
gradle.setCentralRepo(it, project)
70-
}
71-
}
72-
73-
signing {
74-
sign publishing.publications.coding
78+
79+
publishToMavenCentral()
80+
signAllPublications()
7581
}

common/build.gradle

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ plugins {
1818
id 'java-conventions'
1919
id 'java-library'
2020
id 'com.gorylenko.gradle-git-properties' version "${gradleGitPropertiesVersion}"
21-
id 'maven-publish'
2221
id "com.vanniktech.maven.publish"
2322
}
2423

@@ -47,28 +46,35 @@ afterEvaluate {
4746
}
4847

4948
mavenPublishing {
50-
coordinates(GROUP, "dingo-expr-common", VERSION)
51-
publishToMavenCentral()
52-
}
53-
54-
publishing {
55-
publications {
56-
common(MavenPublication) {
57-
artifactId = 'dingo-expr-common'
58-
from components.java
59-
pom {
60-
name = 'dingo-expr-common'
61-
description = 'Relational expression library of Dingo Expression.'
49+
coordinates(project.property("GROUP") as String, "dingo-expr-common", project.property("VERSION") as String)
50+
51+
pom {
52+
name = "dingo-expr-common"
53+
description = "Relational expression library of Dingo Expression."
54+
url= "https://www.dingodb.com/"
55+
56+
licenses {
57+
license {
58+
name = "The Apache License, Version 2.0"
59+
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
6260
}
63-
gradle.setPom(it)
61+
}
62+
63+
developers {
64+
developer {
65+
id = "dingodb"
66+
name = "DingoDB develop team"
67+
email = "dingodb@zetyun.com"
68+
}
69+
}
70+
71+
scm {
72+
connection = "scm:git:git://github.com/dingodb/dingo-expr.git"
73+
developerConnection = "scm:git:ssh://github.com/dingodb/dingo-expr.git"
74+
url = "https://github.com/dingodb/dingo-expr"
6475
}
6576
}
66-
67-
repositories {
68-
gradle.setCentralRepo(it, project)
69-
}
70-
}
71-
72-
signing {
73-
sign publishing.publications.common
74-
}
77+
78+
publishToMavenCentral()
79+
signAllPublications()
80+
}

gradle.properties

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,10 @@ gradleGitPropertiesVersion=2.4.2
7272
#
7373
# MAVEN_USERNAME=xxxx MAVEN_TOKEN=xxxxxxxx gradle publish -Psigning.password=xxxxxx
7474
#
75-
mavenCentralUsername=dingodb
76-
mavenCentralPassword=xxxxxxxx
75+
mavenCentralUsername=xxx
76+
mavenCentralPassword=xxx
77+
78+
# GPG signing info
79+
signing.keyId=xxx
80+
signing.password=xxx
81+
signing.secretKeyRingFile=/path/to/secring.gpg

json/build.gradle

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ plugins {
1818
id 'java-conventions'
1919
id 'java-library'
2020
id 'com.gorylenko.gradle-git-properties' version "${gradleGitPropertiesVersion}"
21-
id 'maven-publish'
2221
id "com.vanniktech.maven.publish"
2322
}
2423

@@ -52,28 +51,35 @@ afterEvaluate {
5251
}
5352

5453
mavenPublishing {
55-
coordinates(GROUP, "dingo-expr-json", VERSION)
56-
publishToMavenCentral()
57-
}
58-
59-
publishing {
60-
publications {
61-
json(MavenPublication) {
62-
artifactId = 'dingo-expr-json'
63-
from components.java
64-
pom {
65-
name = 'dingo-expr-json'
66-
description = 'Json library of Dingo Expression.'
54+
coordinates(project.property("GROUP") as String, "dingo-expr-json", project.property("VERSION") as String)
55+
56+
pom {
57+
name = "dingo-expr-json"
58+
description = "Json library of Dingo Expression."
59+
url= "https://www.dingodb.com/"
60+
61+
licenses {
62+
license {
63+
name = "The Apache License, Version 2.0"
64+
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
6765
}
68-
gradle.setPom(it)
66+
}
67+
68+
developers {
69+
developer {
70+
id = "dingodb"
71+
name = "DingoDB develop team"
72+
email = "dingodb@zetyun.com"
73+
}
74+
}
75+
76+
scm {
77+
connection = "scm:git:git://github.com/dingodb/dingo-expr.git"
78+
developerConnection = "scm:git:ssh://github.com/dingodb/dingo-expr.git"
79+
url = "https://github.com/dingodb/dingo-expr"
6980
}
7081
}
71-
72-
repositories {
73-
gradle.setCentralRepo(it, project)
74-
}
75-
}
76-
77-
signing {
78-
sign publishing.publications.json
79-
}
82+
83+
publishToMavenCentral()
84+
signAllPublications()
85+
}

0 commit comments

Comments
 (0)