Skip to content

Commit 08bca75

Browse files
dfa1claude
andcommitted
build: Maven Central deployment setup
Mirror the vortex-java publish flow: - root pom: scm, plugin-version properties, and a `release` profile (source + javadoc jars, gpg sign, central-publishing-maven-plugin with autoPublish) - per-module <description> on every deployable artifact (Central requires name/description/url/license/scm/developer); benchmark + integration-tests already set maven.deploy.skip - .github/workflows/publish.yml: on a v* tag, build (checkout submodule + Zig), deploy -Prelease, then cut a GitHub release from CHANGELOG.md - CHANGELOG.md with the 0.1 notes Release: set repo secrets CENTRAL_USERNAME/PASSWORD, GPG_PRIVATE_KEY, GPG_PASSPHRASE; register io.github.dfa1 on central.sonatype.com; push tag v0.1. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent e21226f commit 08bca75

11 files changed

Lines changed: 183 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Publish to Maven Central
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
environment: maven
15+
steps:
16+
- name: Checkout (with zstd submodule)
17+
uses: actions/checkout@v4
18+
with:
19+
submodules: recursive
20+
21+
- name: Set up JDK 25 with Maven Central publishing
22+
uses: actions/setup-java@v4
23+
with:
24+
java-version: '25'
25+
distribution: 'zulu'
26+
cache: 'maven'
27+
server-id: central
28+
server-username: CENTRAL_USERNAME
29+
server-password: CENTRAL_PASSWORD
30+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
31+
gpg-passphrase: GPG_PASSPHRASE
32+
33+
- name: Set up Zig
34+
uses: mlugg/setup-zig@v2
35+
with:
36+
version: 0.16.0
37+
38+
- name: Publish to Maven Central
39+
env:
40+
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
41+
CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
42+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
43+
run: ./mvnw deploy -Prelease -DskipTests --batch-mode -ntp
44+
45+
- name: Create GitHub release
46+
env:
47+
GH_TOKEN: ${{ github.token }}
48+
run: |
49+
VERSION="${GITHUB_REF_NAME#v}"
50+
NOTES=$(awk "/^## \[$VERSION\]/{found=1; next} found && /^## \[/{exit} found{print}" CHANGELOG.md)
51+
gh release create "$GITHUB_REF_NAME" \
52+
--title "$GITHUB_REF_NAME" \
53+
--notes "$NOTES" \
54+
--verify-tag

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Changelog
2+
3+
All notable changes to this project are documented here. Format loosely follows
4+
[Keep a Changelog](https://keepachangelog.com/); versions are released as `v*`
5+
git tags, which trigger publication to Maven Central.
6+
7+
## [0.1]
8+
9+
First release. Java 25 Foreign Function & Memory (FFM) bindings for
10+
[Zstandard](https://github.com/facebook/zstd) 1.5.7, built hermetically from
11+
vendored source with `zig cc` (no JNI, no prebuilt binaries). 68 of the public
12+
zstd symbols are bound; see `docs/supported.md`.
13+
14+
### Added
15+
- One-shot compression/decompression over `byte[]` and zero-copy `MemorySegment`
16+
(`Zstd`, `ZstdCompressCtx`, `ZstdDecompressCtx`).
17+
- Dictionaries: training (`ZDICT_trainFromBuffer`, COVER / fast-COVER optimisers,
18+
`finalizeDictionary`), digested `ZstdCompressDict` / `ZstdDecompressDict`,
19+
dictionary ids and header size.
20+
- Streaming: `ZstdOutputStream` / `ZstdInputStream` (java.io) and a zero-copy
21+
`MemorySegment` driver (`ZstdCompressStream` / `ZstdDecompressStream`), with
22+
dictionaries, `pledgedSrcSize`, and live `progress()`.
23+
- All advanced parameters (`ZstdCompressParameter` / `ZstdDecompressParameter`)
24+
with bounds queries; checksum, long-distance matching, window log, etc.
25+
- Frame inspection (`ZstdFrame`): header, content/compressed size, dictionary id,
26+
skippable frames.
27+
- Typed errors (`ZstdException.code()` / `ZstdErrorCode`) and memory accounting
28+
(`sizeOf()`, `Zstd.estimate*Size`).
29+
- Native artifacts for macOS, Linux and Windows on x86_64 and aarch64,
30+
cross-compiled from a single host with `zig cc`.
31+
- Format-compatibility tests against the reference zstd-jni binding.
32+
33+
[0.1]: https://github.com/dfa1/zstd-java/releases/tag/v0.1

bom/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<artifactId>zstd-java-bom</artifactId>
1313
<packaging>pom</packaging>
1414
<name>zstd FFM BOM</name>
15+
<description>Bill of materials for the zstd-java modules</description>
1516

1617
<dependencyManagement>
1718
<dependencies>

native/linux-aarch64/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
<artifactId>zstd-java-native-linux-aarch64</artifactId>
1313
<name>zstd FFM Native linux-aarch64</name>
14+
<description>Native zstd library for Linux aarch64</description>
1415
<packaging>jar</packaging>
1516

1617
<!-- No Java sources: this module only packages the native shared library. -->

native/linux-x86_64/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
<artifactId>zstd-java-native-linux-x86_64</artifactId>
1313
<name>zstd FFM Native linux-x86_64</name>
14+
<description>Native zstd library for Linux x86_64</description>
1415
<packaging>jar</packaging>
1516

1617
<!-- No Java sources: this module only packages the native shared library. -->

native/osx-aarch64/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
<artifactId>zstd-java-native-osx-aarch64</artifactId>
1313
<name>zstd FFM Native osx-aarch64</name>
14+
<description>Native zstd library for macOS aarch64</description>
1415
<packaging>jar</packaging>
1516

1617
<!-- No Java sources: this module only packages the native shared library. -->

native/osx-x86_64/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
<artifactId>zstd-java-native-osx-x86_64</artifactId>
1313
<name>zstd FFM Native osx-x86_64</name>
14+
<description>Native zstd library for macOS x86_64</description>
1415
<packaging>jar</packaging>
1516

1617
<!-- No Java sources: this module only packages the native shared library. -->

native/windows-aarch64/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
<artifactId>zstd-java-native-windows-aarch64</artifactId>
1313
<name>zstd FFM Native windows-aarch64</name>
14+
<description>Native zstd library for Windows aarch64</description>
1415
<packaging>jar</packaging>
1516

1617
<!-- No Java sources: this module only packages the native shared library. -->

native/windows-x86_64/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
<artifactId>zstd-java-native-windows-x86_64</artifactId>
1313
<name>zstd FFM Native windows-x86_64</name>
14+
<description>Native zstd library for Windows x86_64</description>
1415
<packaging>jar</packaging>
1516

1617
<!-- No Java sources: this module only packages the native shared library. -->

pom.xml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@
2727
</developer>
2828
</developers>
2929

30+
<scm>
31+
<connection>scm:git:https://github.com/dfa1/zstd-java.git</connection>
32+
<developerConnection>scm:git:git@github.com:dfa1/zstd-java.git</developerConnection>
33+
<url>https://github.com/dfa1/zstd-java</url>
34+
<tag>HEAD</tag>
35+
</scm>
36+
3037
<modules>
3138
<module>native/osx-aarch64</module>
3239
<module>native/osx-x86_64</module>
@@ -43,6 +50,10 @@
4350
<properties>
4451
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4552
<maven.compiler.release>25</maven.compiler.release>
53+
<central-publishing-plugin.version>0.11.0</central-publishing-plugin.version>
54+
<maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
55+
<maven-source-plugin.version>3.4.0</maven-source-plugin.version>
56+
<maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
4657
</properties>
4758

4859
<dependencyManagement>
@@ -186,4 +197,81 @@
186197
</plugin>
187198
</plugins>
188199
</build>
200+
201+
<profiles>
202+
<!-- Release to Maven Central: ./mvnw deploy -Prelease
203+
Prerequisites:
204+
1. Register namespace io.github.dfa1 at central.sonatype.com.
205+
2. Generate a user token (Account / User Tokens) and add it to
206+
~/.m2/settings.xml as a server with id "central".
207+
3. A published GPG key.
208+
CI does this on a v* tag via .github/workflows/publish.yml. -->
209+
<profile>
210+
<id>release</id>
211+
<build>
212+
<plugins>
213+
<plugin>
214+
<groupId>org.apache.maven.plugins</groupId>
215+
<artifactId>maven-source-plugin</artifactId>
216+
<version>${maven-source-plugin.version}</version>
217+
<executions>
218+
<execution>
219+
<id>attach-sources</id>
220+
<goals>
221+
<goal>jar-no-fork</goal>
222+
</goals>
223+
</execution>
224+
</executions>
225+
</plugin>
226+
<plugin>
227+
<groupId>org.apache.maven.plugins</groupId>
228+
<artifactId>maven-javadoc-plugin</artifactId>
229+
<version>${maven-javadoc-plugin.version}</version>
230+
<executions>
231+
<execution>
232+
<id>attach-javadocs</id>
233+
<goals>
234+
<goal>jar</goal>
235+
</goals>
236+
</execution>
237+
</executions>
238+
<configuration>
239+
<doclint>none</doclint>
240+
</configuration>
241+
</plugin>
242+
<plugin>
243+
<groupId>org.apache.maven.plugins</groupId>
244+
<artifactId>maven-gpg-plugin</artifactId>
245+
<version>${maven-gpg-plugin.version}</version>
246+
<executions>
247+
<execution>
248+
<id>sign-artifacts</id>
249+
<phase>verify</phase>
250+
<goals>
251+
<goal>sign</goal>
252+
</goals>
253+
<configuration>
254+
<gpgArguments>
255+
<arg>--pinentry-mode</arg>
256+
<arg>loopback</arg>
257+
</gpgArguments>
258+
</configuration>
259+
</execution>
260+
</executions>
261+
</plugin>
262+
<plugin>
263+
<groupId>org.sonatype.central</groupId>
264+
<artifactId>central-publishing-maven-plugin</artifactId>
265+
<version>${central-publishing-plugin.version}</version>
266+
<extensions>true</extensions>
267+
<configuration>
268+
<publishingServerId>central</publishingServerId>
269+
<autoPublish>true</autoPublish>
270+
<waitUntil>published</waitUntil>
271+
</configuration>
272+
</plugin>
273+
</plugins>
274+
</build>
275+
</profile>
276+
</profiles>
189277
</project>

0 commit comments

Comments
 (0)