Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/release-js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release Scala.js

on:
push:
tags:
- v*
workflow_dispatch:

jobs:
publish_js:
name: Publish Scala.js
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
# Fetch all tags so that sbt-dynver can find the previous release version
fetch-depth: 0
- run: git fetch --tags -f
- uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: '23'
cache: sbt
- uses: actions/setup-node@v6
with:
node-version: '20'
- name: Setup GPG
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
run: echo $PGP_SECRET | base64 --decode | gpg --import --batch --yes
- name: Build for Scala.js
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
run: ./sbt publishJSSigned
- name: Release to Sonatype
env:
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USER }}'
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASS }}'
run: ./sbt sonaRelease
38 changes: 38 additions & 0 deletions .github/workflows/release-native.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release Scala Native

on:
push:
tags:
- v*
workflow_dispatch:

jobs:
publish_native:
name: Publish Scala Native
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
# Fetch all tags so that sbt-dynver can find the previous release version
fetch-depth: 0
- run: git fetch --tags -f
- uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: '23'
cache: sbt
- name: Install native dependencies
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
- name: Setup GPG
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
run: echo $PGP_SECRET | base64 --decode | gpg --import --batch --yes
- name: Build for Scala Native
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
run: ./sbt publishNativeSigned
- name: Release to Sonatype
env:
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USER }}'
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASS }}'
run: ./sbt sonaRelease
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release Scala JVM

on:
push:
tags:
- v*
workflow_dispatch:

jobs:
publish_jvm:
name: Publish Scala JVM
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
# Fetch all tags so that sbt-dynver can find the previous release version
fetch-depth: 0
- run: git fetch --tags -f
- uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: '23'
cache: sbt
- name: Setup GPG
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
run: echo $PGP_SECRET | base64 --decode | gpg --import --batch --yes
- name: Build bundle
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
run: |
./sbt "projectJVM/publishSigned"
- name: Release to Sonatype
env:
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USER }}'
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASS }}'
run: ./sbt sonaRelease
50 changes: 44 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,34 @@ import sbtide.Keys.ideSkipProject

Global / onChangedBuildSource := ReloadOnSourceChanges

ThisBuild / organization := "org.wvlet.uni"

// Use dynamic snapshot version strings for non tagged versions
ThisBuild / dynverSonatypeSnapshots := true
// Use coursier friendly version separator
ThisBuild / dynverSeparator := "-"

// For Sonatype
ThisBuild / publishTo := {
val centralSnapshots = "https://central.sonatype.com/repository/maven-snapshots/"
if (isSnapshot.value) Some("central-snapshots" at centralSnapshots)
else localStaging.value
}

// Publishing command aliases
addCommandAlias(
"publishSnapshots",
s"projectJVM/publish; projectJS/publish; projectNative/publish"
)
addCommandAlias(
"publishJSSigned",
s"projectJS/publishSigned"
)
addCommandAlias(
"publishNativeSigned",
s"projectNative/publishSigned"
)

val SCALA_3 = "3.8.2"
val AIRFRAME_VERSION = "2026.1.4"
val AWS_SDK_VERSION = "2.42.14"
Expand All @@ -13,12 +41,22 @@ val SCALACHECK_VERSION = "1.19.0"

// Common build settings
val buildSettings = Seq[Setting[?]](
organization := "org.wvlet.uni",
description := "Scala 3 unified utility library",
scalaVersion := SCALA_3,
crossScalaVersions := List(SCALA_3),
crossPaths := true,
publishMavenStyle := true,
description := "Scala 3 unified utility library",
scalaVersion := SCALA_3,
crossScalaVersions := List(SCALA_3),
crossPaths := true,
publishMavenStyle := true,
licenses += ("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.html")),
homepage := Some(url("https://github.com/wvlet/uni")),
scmInfo := Some(
ScmInfo(
browseUrl = url("https://github.com/wvlet/uni"),
connection = "scm:git:git@github.com:wvlet/uni.git"
)
),
developers := List(
Developer(id = "leo", name = "Taro L. Saito", email = "leo@xerial.org", url = url("http://xerial.org/leo"))
),
Test / parallelExecution := false,
// Use UniTest for testing
libraryDependencies ++=
Expand Down
39 changes: 39 additions & 0 deletions plans/2026-03-22-publish-uni.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Publish uni 2026.1.0 to Maven Central

## Context
uni needs to be published to Maven Central so wvlet (and GitHub Actions CI) can depend on it as a normal library dependency. The versioning scheme is `YYYY.(milestone).patch`, with `2026.1.0` as the first release.

## Approach
Mirror airframe's publishing setup, adapted for uni's Scala 3-only structure.

## Changes

### Plugins (`project/plugin.sbt`)
- Added `sbt-pgp` 2.3.1 for GPG signing
- Added `sbt-sonatype` 3.12.2 for Maven Central release

### Build settings (`build.sbt`)
- `ThisBuild` level: `organization`, `dynverSonatypeSnapshots`, `dynverSeparator`, `publishTo`
- POM metadata: `licenses`, `homepage`, `scmInfo`, `developers`
- Command aliases: `publishSnapshots`, `publishJSSigned`, `publishNativeSigned`

### GitHub Actions release workflows
- `release.yml` — JVM artifacts
- `release-js.yml` — Scala.js artifacts
- `release-native.yml` — Scala Native artifacts

All triggered on `v*` tags. Required secrets: `PGP_SECRET`, `PGP_PASSPHRASE`, `SONATYPE_USER`, `SONATYPE_PASS`.

### Published modules
- `uni-core` (JVM/JS/Native)
- `uni` (JVM/JS/Native)
- `uni-test` (JVM/JS/Native)
- `uni-agent`, `uni-bedrock`, `uni-netty` (JVM only)

### Skipped modules
- root, projectJVM, projectJS, projectNative, domTest, integrationTest

## Release process
1. Tag: `git tag v2026.1.0 && git push origin v2026.1.0`
2. GitHub Actions automatically publishes to Maven Central
3. Verify at https://central.sonatype.com/search?q=org.wvlet.uni
3 changes: 3 additions & 0 deletions project/plugin.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ ThisBuild / libraryDependencySchemes ++=

val AIRFRAME_VERSION = "2026.1.4"

// For GPG signing published artifacts
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1")

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.6")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.13.1")
Expand Down
33 changes: 33 additions & 0 deletions project/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -e

# Release script for uni
# Versioning scheme: YYYY.(milestone).patch

current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "${current_branch}" != "main" ]; then
echo "release.sh must run on main branch. The current branch is ${current_branch}"
exit 1
fi

last_tag=$(git describe --tags --abbrev=0)
last_version=${last_tag#v}
echo "last version: ${last_version}"

current_year=$(date +%Y)
IFS='.' read -r year milestone patch <<< "${last_version}"

if [ "${year}" = "${current_year}" ]; then
patch=$((patch + 1))
else
milestone=1
patch=0
fi
default_version="${current_year}.${milestone}.${patch}"

read -p "next version (default: ${default_version})? " next_version
next_version=${next_version:-${default_version}}

set -x
git tag -a -m "uni ${next_version}" "v${next_version}"
git push --follow-tags
Loading