Skip to content

Commit 6d25a37

Browse files
xerialclaude
andauthored
Migrate to sonaRelease command for publishing (#676)
* Update CLAUDE.md development workflow - Fix typo in 'commit' - Add PR guidelines and common development tasks - Update native code build command to use 'make clean-native native' * Update Snappy version to 1.2.2 and fix test compatibility - Update SNAPPY_VERSION from 1.1.10 to 1.2.2 in VERSION file - Fix SnappyOutputStreamTest expected compression size for aarch64 (90277 bytes) to match improved compression ratio in Snappy 1.2.2 - All tests pass with new version Fixes #662 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Update CI to trigger tests on Makefile and VERSION changes - Add Makefile* pattern to catch all Makefile variants - Add **/VERSION pattern to catch VERSION files anywhere in repo - Ensures tests run when native build configuration or versions change 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Migrate to sonaRelease command for publishing - Remove sbt-sonatype plugin dependency - Update to sbt 1.11.3 for built-in Sonatype support - Replace sonatypePublishToBundle with direct Sonatype URLs - Add release process documentation to CLAUDE.md - Simplify publishing workflow using built-in sbt functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Update publishTo to use Central Portal URLs and localStaging - Use https://central.sonatype.com/repository/maven-snapshots/ for snapshots - Use localStaging.value for releases to support sonaRelease workflow * Revert unintended changes to keep PR focused on sonaRelease migration - Revert SNAPPY_VERSION upgrade (1.2.2 -> 1.1.10) - Revert SnappyOutputStreamTest compression ratio change - Revert native library binary update - Revert CI workflow trigger additions These changes should be in separate PRs, not part of the publishing migration. * Update release.yml to use sonaRelease command - Replace sonatypeBundleRelease with sonaRelease - Update environment variable names to standard SONATYPE_USERNAME/PASSWORD - Aligns with sbt's built-in Sonatype publishing workflow * Update snapshot.yml environment variable names - Update SONATYPE_USER to SONATYPE_USERNAME - Update SONATYPE_PASS to SONATYPE_PASSWORD - Aligns with standard naming used in sonaRelease workflow --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7fb9221 commit 6d25a37

File tree

5 files changed

+35
-9
lines changed

5 files changed

+35
-9
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ jobs:
3232
./sbt publishSigned
3333
- name: Release to Sonatype
3434
env:
35-
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USER }}'
36-
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASS }}'
37-
run: ./sbt sonatypeBundleRelease
35+
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USERNAME }}'
36+
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASSWORD }}'
37+
run: ./sbt sonaRelease

.github/workflows/snapshot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ jobs:
3434
restore-keys: ${{ runner.os }}-snapshot-
3535
- name: Publish snapshots
3636
env:
37-
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USER }}'
38-
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASS }}'
37+
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USERNAME }}'
38+
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASSWORD }}'
3939
run: ./sbt publish

CLAUDE.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,31 @@ The project uses Docker-based cross-compilation toolchains (see `docker/` direct
107107
- Run tests before creating PR: `./sbt test`
108108
- Format code: `./sbt scalafmtAll`
109109

110+
### Release Process
111+
The project uses sbt's built-in Sonatype integration for publishing:
112+
113+
```bash
114+
# 1. Stage artifacts to Sonatype
115+
./sbt publishSigned
116+
117+
# 2. Release to Maven Central
118+
./sbt sonaRelease
119+
```
120+
121+
**Prerequisites:**
122+
- Set up Sonatype credentials in `~/.sbt/1.0/sonatype.sbt`:
123+
```scala
124+
credentials += Credentials("Sonatype Nexus Repository Manager",
125+
"s01.oss.sonatype.org",
126+
"<username>",
127+
"<password>")
128+
```
129+
- Configure PGP signing for artifact signing
130+
110131
### Common Development Tasks
111132
- When making changes to native code, rebuild with `make clean-native native`
112133
- For Java/Scala changes, use `./sbt ~test` for continuous testing
113-
- Always test on multiple JDK versions if possible (8, 11, 17, 21)
134+
- Always test on multiple JDK versions if possible (8, 11, 17, 21)
135+
136+
### Native Code Testing
137+
- Use make clean-native native for testing native code

build.sbt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ organization := "org.xerial.snappy"
55
organizationName := "xerial.org"
66
description := "snappy-java: A fast compression/decompression library"
77

8-
sonatypeProfileName := "org.xerial"
9-
ThisBuild / publishTo := sonatypePublishToBundle.value
8+
ThisBuild / publishTo := {
9+
val centralSnapshots = "https://central.sonatype.com/repository/maven-snapshots/"
10+
if (isSnapshot.value) Some("central-snapshots" at centralSnapshots)
11+
else localStaging.value
12+
}
1013
licenses := Seq("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.html"))
1114
homepage := Some(url("https://github.com/xerial/snappy-java"))
1215
scmInfo := Some(

project/plugins.sbt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.12.2")
21
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1")
32
addSbtPlugin("com.github.sbt" % "sbt-osgi" % "0.10.0")
43
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.5")

0 commit comments

Comments
 (0)