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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
- uses: actions/checkout@v7
with:
lfs: true
fetch-depth: 0
fetch-tags: true

- uses: actions/cache@v6
with:
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Release

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+*' # 0.2.7, 0.2.7-M1, 0.2.7-RC1 — no v prefix

permissions:
contents: write # create release + upload assets

jobs:
release:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
with:
# sbt-dynver derives the version from `git describe`, which needs tags + history
fetch-depth: 0
fetch-tags: true
lfs: true

- uses: actions/cache@v6
with:
path: |
~/.sbt
~/.m2
~/.ivy2
~/.cache
key: ${{ runner.os }}-build-${{ hashFiles('build.sbt', 'project/**') }}

- uses: actions/setup-java@v6
with:
distribution: temurin
java-version: 21

- uses: sbt/setup-sbt@v1

- name: Import PGP key
run: echo "$PGP_SECRET" | gpg --batch --import
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}

- name: Verify version is derived from the tag
run: sbt --server -mem 3000 assertTagVersion

- name: Run tests
run: sbt --server -mem 3000 test

- name: Publish to Maven Central
run: sbt --server -mem 3000 publishSigned sonaRelease
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}

- name: Create GitHub release
uses: softprops/action-gh-release@v3
with:
generate_release_notes: true
prerelease: ${{ contains(github.ref_name, '-') }} # 0.2.7-M1 → pre-release
files: target/out/jvm/*/ltrlib/ltrlib_*-${{ github.ref_name }}.jar
15 changes: 13 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
import Deps._

name := "ltrlib"
ThisBuild / dynverVTagPrefix := false
ThisBuild / versionScheme := Some("early-semver")

ThisBuild / credentials ++= (for {
user <- sys.env.get("SONATYPE_USERNAME")
pass <- sys.env.get("SONATYPE_PASSWORD")
} yield Credentials("Sonatype Central Portal", "central.sonatype.com", user, pass)).toList

version := "0.2.6"
lazy val assertTagVersion = taskKey[Unit]("assert that version is derived from an exact git tag")
assertTagVersion := {
if (isSnapshot.value) sys.error(s"version ${version.value} is not an exact git tag version")
}

name := "ltrlib"

scalaVersion := "3.9.0"

Expand Down
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.7.0")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.2")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.6.2")
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.1.1")