Skip to content

Commit b9a241c

Browse files
feat: prepare Maven plugin for publishing
Signed-off-by: Vytautas Astrauskas <vytautas.astrauskas@sensmetry.com>
1 parent ac2bf0b commit b9a241c

4 files changed

Lines changed: 123 additions & 10 deletions

File tree

.github/workflows/java.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ jobs:
4545
shell: bash
4646
if: ${{ matrix.os == 'ubuntu-22.04' }}
4747
run: python bindings/java/scripts/java-builder.py create-version-file
48+
env:
49+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }}
4850
- name: Upload native bindings
4951
uses: actions/upload-artifact@v5
5052
with:
@@ -76,6 +78,8 @@ jobs:
7678
with:
7779
distribution: 'temurin'
7880
java-version: '21'
81+
gpg-private-key: ${{ secrets.MAVEN_CENTRAL_GPG_PRIVATE_KEY }}
82+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
7983
- name: Download version.txt
8084
uses: actions/download-artifact@v6
8185
with:
@@ -90,9 +94,13 @@ jobs:
9094
- name: Build JAR
9195
shell: bash
9296
run: python bindings/java/scripts/java-builder.py build --use-existing-native-libs native-bindings --use-release-build
97+
env:
98+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }}
9399
- name: Build Sysand Maven plugin and run integration tests
94100
shell: bash
95101
run: python bindings/java/scripts/java-builder.py build-plugin
102+
env:
103+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }}
96104
- name: Upload JARs
97105
uses: actions/upload-artifact@v5
98106
with:
@@ -144,9 +152,13 @@ jobs:
144152
with:
145153
distribution: 'temurin'
146154
java-version: '21'
155+
gpg-private-key: ${{ secrets.MAVEN_CENTRAL_GPG_PRIVATE_KEY }}
156+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
147157
- name: Test Java JAR
148158
shell: bash
149159
run: python bindings/java/scripts/java-builder.py test
160+
env:
161+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }}
150162

151163
nightly-release:
152164
name: Nightly Release
@@ -195,9 +207,12 @@ jobs:
195207
server-id: central
196208
server-username: MAVEN_USERNAME
197209
server-password: MAVEN_PASSWORD
210+
gpg-private-key: ${{ secrets.MAVEN_CENTRAL_GPG_PRIVATE_KEY }}
211+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
198212
- name: Deploy Java bindings
199213
shell: bash
200214
run: python bindings/java/scripts/java-builder.py deploy
201215
env:
202216
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_TOKEN_USERNAME }}
203217
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN_PASSWORD }}
218+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }}

bindings/java/java/pom.xml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ SPDX-License-Identifier: MIT OR Apache-2.0
1818
<licenses>
1919
<license>
2020
<name>The Apache License, Version 2.0</name>
21-
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
21+
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
2222
</license>
2323
<license>
2424
<name>MIT License</name>
25-
<url>http://www.opensource.org/licenses/mit-license.php</url>
25+
<url>https://opensource.org/license/mit</url>
2626
</license>
2727
</licenses>
2828
<developers>
@@ -34,9 +34,9 @@ SPDX-License-Identifier: MIT OR Apache-2.0
3434
</developer>
3535
</developers>
3636
<scm>
37-
<connection>scm:git:git://github.com/sensmetry/sysand.git</connection>
38-
<developerConnection>scm:git:ssh://github.com:sensmetry/sysand.git</developerConnection>
39-
<url>https://github.com/sensmetry/sysand/tree/master</url>
37+
<connection>scm:git:https://github.com/sensmetry/sysand</connection>
38+
<developerConnection>scm:git:ssh://git@github.com/sensmetry/sysand.git</developerConnection>
39+
<url>https://github.com/sensmetry/sysand/tree/main</url>
4040
</scm>
4141
<properties>
4242
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -116,6 +116,26 @@ SPDX-License-Identifier: MIT OR Apache-2.0
116116
</execution>
117117
</executions>
118118
</plugin>
119+
<!-- Sign with gpg -->
120+
<plugin>
121+
<artifactId>maven-gpg-plugin</artifactId>
122+
<version>3.2.4</version>
123+
<executions>
124+
<execution>
125+
<id>sign-artifacts</id>
126+
<phase>verify</phase>
127+
<goals>
128+
<goal>sign</goal>
129+
</goals>
130+
<configuration>
131+
<gpgArguments>
132+
<arg>--pinentry-mode</arg>
133+
<arg>loopback</arg>
134+
</gpgArguments>
135+
</configuration>
136+
</execution>
137+
</executions>
138+
</plugin>
119139
<!-- Copy README.md to javadoc output -->
120140
<plugin>
121141
<groupId>org.apache.maven.plugins</groupId>

bindings/java/plugin/pom.xml

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,31 @@ SPDX-License-Identifier: MIT OR Apache-2.0
1313
<version>VERSION</version>
1414
<packaging>maven-plugin</packaging>
1515
<name>${project.groupId}:${project.artifactId}</name>
16-
<description>Maven plugin to invoke Sysand.info_path at package phase</description>
16+
<description>Maven plugin for using Sysand.</description>
17+
<url>https://sysand.org/</url>
18+
<licenses>
19+
<license>
20+
<name>The Apache License, Version 2.0</name>
21+
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
22+
</license>
23+
<license>
24+
<name>MIT License</name>
25+
<url>https://opensource.org/license/mit</url>
26+
</license>
27+
</licenses>
28+
<developers>
29+
<developer>
30+
<name>Sensmetry</name>
31+
<email>opensource@sensmetry.com</email>
32+
<organization>Sensmetry</organization>
33+
<organizationUrl>https://sensmetry.com/</organizationUrl>
34+
</developer>
35+
</developers>
36+
<scm>
37+
<connection>scm:git:https://github.com/sensmetry/sysand</connection>
38+
<developerConnection>scm:git:ssh://git@github.com/sensmetry/sysand.git</developerConnection>
39+
<url>https://github.com/sensmetry/sysand/tree/main</url>
40+
</scm>
1741
<properties>
1842
<maven.compiler.source>1.8</maven.compiler.source>
1943
<maven.compiler.target>1.8</maven.compiler.target>
@@ -118,6 +142,54 @@ SPDX-License-Identifier: MIT OR Apache-2.0
118142
</execution>
119143
</executions>
120144
</plugin>
145+
<!-- Attach -sources.jar -->
146+
<plugin>
147+
<groupId>org.apache.maven.plugins</groupId>
148+
<artifactId>maven-source-plugin</artifactId>
149+
<version>3.3.1</version>
150+
<executions>
151+
<execution>
152+
<id>attach-sources</id>
153+
<goals>
154+
<goal>jar</goal>
155+
</goals>
156+
</execution>
157+
</executions>
158+
</plugin>
159+
<!-- Attach -javadoc.jar -->
160+
<plugin>
161+
<groupId>org.apache.maven.plugins</groupId>
162+
<artifactId>maven-javadoc-plugin</artifactId>
163+
<version>3.8.0</version>
164+
<executions>
165+
<execution>
166+
<id>attach-javadoc</id>
167+
<goals>
168+
<goal>jar</goal>
169+
</goals>
170+
</execution>
171+
</executions>
172+
</plugin>
173+
<!-- Sign with gpg -->
174+
<plugin>
175+
<artifactId>maven-gpg-plugin</artifactId>
176+
<version>3.2.4</version>
177+
<executions>
178+
<execution>
179+
<id>sign-artifacts</id>
180+
<phase>verify</phase>
181+
<goals>
182+
<goal>sign</goal>
183+
</goals>
184+
<configuration>
185+
<gpgArguments>
186+
<arg>--pinentry-mode</arg>
187+
<arg>loopback</arg>
188+
</gpgArguments>
189+
</configuration>
190+
</execution>
191+
</executions>
192+
</plugin>
121193
<!-- Publish to Maven Central via Central Portal -->
122194
<plugin>
123195
<groupId>org.sonatype.central</groupId>

bindings/java/scripts/java-builder.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import argparse
88
import json
9+
import os
910
from pathlib import Path
1011
import platform
1112
import shutil
@@ -346,6 +347,11 @@ def test(version: str, release_jar_version: bool) -> None:
346347

347348
def main() -> None:
348349
args = parse_args()
350+
release_jar_version = args.release_jar_version
351+
# Check environment variable for release-jar-version flag
352+
TRUE_CONSTANTS = ("1", "true")
353+
if os.getenv("JAVA_BUILDER_RELEASE_JAR_VERSION", "").lower() in TRUE_CONSTANTS:
354+
release_jar_version = True
349355
print("ROOT_DIR:", ROOT_DIR)
350356
print("BUILD_DIR:", BUILD_DIR)
351357
print("TEST_DIR:", TEST_DIR)
@@ -355,15 +361,15 @@ def main() -> None:
355361
build(
356362
args.use_release_build,
357363
args.use_existing_native_libs,
358-
args.release_jar_version,
364+
release_jar_version,
359365
version,
360366
)
361367
elif args.command == "build-plugin":
362-
build_plugin(version, args.release_jar_version)
368+
build_plugin(version, release_jar_version)
363369
elif args.command == "test":
364-
test(version, args.release_jar_version)
370+
test(version, release_jar_version)
365371
elif args.command == "test-deployed":
366-
test_deployed(version, args.release_jar_version)
372+
test_deployed(version, release_jar_version)
367373
elif args.command == "deploy":
368374
deploy()
369375
elif args.command == "create-version-file":

0 commit comments

Comments
 (0)