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>
This commit is contained in:
Taro L. Saito 2025-07-19 11:16:45 -07:00 committed by GitHub
parent 7fb9221328
commit 6d25a37cbe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 35 additions and 9 deletions

View File

@ -32,6 +32,6 @@ jobs:
./sbt publishSigned
- name: Release to Sonatype
env:
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USER }}'
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASS }}'
run: ./sbt sonatypeBundleRelease
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USERNAME }}'
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASSWORD }}'
run: ./sbt sonaRelease

View File

@ -34,6 +34,6 @@ jobs:
restore-keys: ${{ runner.os }}-snapshot-
- name: Publish snapshots
env:
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USER }}'
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASS }}'
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USERNAME }}'
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASSWORD }}'
run: ./sbt publish

View File

@ -107,7 +107,31 @@ The project uses Docker-based cross-compilation toolchains (see `docker/` direct
- Run tests before creating PR: `./sbt test`
- Format code: `./sbt scalafmtAll`
### Release Process
The project uses sbt's built-in Sonatype integration for publishing:
```bash
# 1. Stage artifacts to Sonatype
./sbt publishSigned
# 2. Release to Maven Central
./sbt sonaRelease
```
**Prerequisites:**
- Set up Sonatype credentials in `~/.sbt/1.0/sonatype.sbt`:
```scala
credentials += Credentials("Sonatype Nexus Repository Manager",
"s01.oss.sonatype.org",
"<username>",
"<password>")
```
- Configure PGP signing for artifact signing
### Common Development Tasks
- When making changes to native code, rebuild with `make clean-native native`
- For Java/Scala changes, use `./sbt ~test` for continuous testing
- Always test on multiple JDK versions if possible (8, 11, 17, 21)
- Always test on multiple JDK versions if possible (8, 11, 17, 21)
### Native Code Testing
- Use make clean-native native for testing native code

View File

@ -5,8 +5,11 @@ organization := "org.xerial.snappy"
organizationName := "xerial.org"
description := "snappy-java: A fast compression/decompression library"
sonatypeProfileName := "org.xerial"
ThisBuild / publishTo := sonatypePublishToBundle.value
ThisBuild / publishTo := {
val centralSnapshots = "https://central.sonatype.com/repository/maven-snapshots/"
if (isSnapshot.value) Some("central-snapshots" at centralSnapshots)
else localStaging.value
}
licenses := Seq("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.html"))
homepage := Some(url("https://github.com/xerial/snappy-java"))
scmInfo := Some(

View File

@ -1,4 +1,3 @@
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.12.2")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1")
addSbtPlugin("com.github.sbt" % "sbt-osgi" % "0.10.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.5")