Add release automation workflow (#384)

This commit is contained in:
Taro L. Saito 2023-01-28 00:33:40 -08:00 committed by GitHub
parent 34fa6e9e65
commit c515db5857
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 62 additions and 38 deletions

37
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,37 @@
name: Release
on:
push:
tags:
- v*
workflow_dispatch:
jobs:
publish_jvm:
name: Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 10000
# Fetch all tags so that sbt-dynver can find the previous release version
- run: git fetch --tags -f
# Install OpenJDK 11
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
- 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 publishSigned
- name: Release to Sonatype
env:
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USER }}'
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASS }}'
run: ./sbt sonatypeBundleRelease

View File

@ -140,7 +140,10 @@ NATIVE_DIR:=src/main/resources/org/xerial/snappy/native/$(OS_NAME)/$(OS_ARCH)
NATIVE_TARGET_DIR:=$(TARGET)/classes/org/xerial/snappy/native/$(OS_NAME)/$(OS_ARCH) NATIVE_TARGET_DIR:=$(TARGET)/classes/org/xerial/snappy/native/$(OS_NAME)/$(OS_ARCH)
NATIVE_DLL:=$(NATIVE_DIR)/$(LIBNAME) NATIVE_DLL:=$(NATIVE_DIR)/$(LIBNAME)
snappy-jar-version:=snappy-java-$(shell cat version.sbt | cut -d'=' -f2 | sed 's/[ \"]//g') snappy-jar-version:=snappy-java-$(shell ./script/dynver.sh | cut -d'=' -f2 | sed 's/[ \"]//g')
jar-version:
echo $(snappy-jar-version)
native: jni-header snappy-header $(NATIVE_DLL) native: jni-header snappy-header $(NATIVE_DLL)
native-nocmake: jni-header $(NATIVE_DLL) native-nocmake: jni-header $(NATIVE_DLL)

View File

@ -19,6 +19,11 @@ developers := List(
Developer(id = "leo", name = "Taro L. Saito", email = "leo@xerial.org", url = url("http://xerial.org/leo")) Developer(id = "leo", name = "Taro L. Saito", email = "leo@xerial.org", url = url("http://xerial.org/leo"))
) )
// Use dynamic snapshot version strings for non tagged versions
ThisBuild / dynverSonatypeSnapshots := true
// Use coursier friendly version separator
ThisBuild / dynverSeparator := "-"
ThisBuild / scalaVersion := "2.12.11" ThisBuild / scalaVersion := "2.12.11"
// For building jars for JDK8 // For building jars for JDK8
@ -108,22 +113,3 @@ OsgiKeys.additionalHeaders := Map(
"Bundle-ActivationPolicy" -> "lazy", "Bundle-ActivationPolicy" -> "lazy",
"Bundle-Name" -> "snappy-java: A fast compression/decompression library" "Bundle-Name" -> "snappy-java: A fast compression/decompression library"
) )
import ReleaseTransformations._
releaseTagName := { (ThisBuild / version).value }
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommand("publishSigned"),
releaseStepCommand("sonatypeBundleRelease"),
setNextVersion,
commitNextVersion,
pushChanges
)

View File

@ -1,4 +1,3 @@
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.17") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.17")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1") addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.6") addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.6")

View File

@ -1 +0,0 @@
ThisBuild / version := "1.1.9.0-SNAPSHOT"