Skip to content

Commit 7c3b6e5

Browse files
authored
Add a script for releasing a new version of msgpack-java at CI
1 parent 3539d97 commit 7c3b6e5

File tree

4 files changed

+57
-46
lines changed

4 files changed

+57
-46
lines changed

.github/workflows/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Release to Sonatype
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
workflow_dispatch:
8+
9+
jobs:
10+
publish:
11+
name: Release
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 10000
17+
# Fetch all tags so that sbt-dynver can find the previous release version
18+
- run: git fetch --tags -f
19+
# Install OpenJDK 11
20+
- uses: olafurpg/setup-scala@v10
21+
with:
22+
java-version: adopt@1.11
23+
- name: Setup GPG
24+
env:
25+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
26+
run: echo $PGP_SECRET | base64 --decode | gpg --import --batch --yes
27+
- name: Build bundle
28+
env:
29+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
30+
run: |
31+
./sbt publish
32+
- name: Release to Sonatype
33+
env:
34+
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USER }}'
35+
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASS }}'
36+
run: ./sbt sonatypeBundleRelease

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ Here is a list of sbt commands for daily development:
9393
> sonatypeBundleRelease # Publish to the Maven Central (It will be synched within less than 4 hours)
9494
```
9595

96-
For publishing to Maven central, msgpack-java uses [sbt-sonatype](https://github.com/xerial/sbt-sonatype) plugin. Set Sonatype account information (user name and password) in the global sbt settings. To protect your password, never include this file in your project.
96+
Once you run a release command, a new git tag v(version number) will be pushed to GitHub. GitHub Action will deploy a new release version to Maven Central (Sonatype).
97+
98+
For publishing to Maven central using a local machine, msgpack-java uses [sbt-sonatype](https://github.com/xerial/sbt-sonatype) plugin. Set Sonatype account information (user name and password) in the global sbt settings. To protect your password, never include this file in your project.
9799

98100
___$HOME/.sbt/(sbt-version)/sonatype.sbt___
99101

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ val buildSettings = Seq[Setting[_]](
2222
// msgpack-java should be a pure-java library, so remove Scala specific configurations
2323
autoScalaLibrary := false,
2424
crossPaths := false,
25+
publishMavenStyle := true,
2526
// JVM options for building
2627
scalacOptions ++= Seq("-encoding", "UTF-8", "-deprecation", "-unchecked", "-feature"),
2728
Test / javaOptions ++= Seq("-ea"),

sonatype.sbt

Lines changed: 17 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,18 @@
1-
sonatypeProfileName := "org.msgpack"
1+
import xerial.sbt.Sonatype._
22

3-
pomExtra in Global := {
4-
<url>http://msgpack.org/</url>
5-
<licenses>
6-
<license>
7-
<name>Apache 2</name>
8-
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
9-
</license>
10-
</licenses>
11-
<scm>
12-
<connection>scm:git:github.com/msgpack/msgpack-java.git</connection>
13-
<developerConnection>scm:git:git@github.com:msgpack/msgpack-java.git</developerConnection>
14-
<url>github.com/msgpack/msgpack-java.git</url>
15-
</scm>
16-
<properties>
17-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18-
</properties>
19-
<developers>
20-
<developer>
21-
<id>frsyuki</id>
22-
<name>Sadayuki Furuhashi</name>
23-
<email>frsyuki@users.sourceforge.jp</email>
24-
</developer>
25-
<developer>
26-
<id>muga</id>
27-
<name>Muga Nishizawa</name>
28-
<email>muga.nishizawa@gmail.com</email>
29-
</developer>
30-
<developer>
31-
<id>oza</id>
32-
<name>Tsuyoshi Ozawa</name>
33-
<url>https://github.com/oza</url>
34-
</developer>
35-
<developer>
36-
<id>komamitsu</id>
37-
<name>Mitsunori Komatsu</name>
38-
<email>komamitsu@gmail.com</email>
39-
</developer>
40-
<developer>
41-
<id>xerial</id>
42-
<name>Taro L. Saito</name>
43-
<email>leo@xerial.org</email>
44-
</developer>
45-
</developers>
46-
}
3+
ThisBuild / sonatypeProfileName := "org.msgpack"
4+
ThisBuild / homepage := Some(url("https://msgpack.org/"))
5+
ThisBuild / licenses := Seq("APL2" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
6+
ThisBuild / scmInfo := Some(
7+
ScmInfo(
8+
url("https://github.com/msgpack/msgpack-java"),
9+
"scm:git@github.com:msgpack/msgpack-java.git"
10+
)
11+
)
12+
ThisBuild / developers := List(
13+
Developer(id = "frsyuki", name = "Sadayuki Furuhashi", email = "frsyuki@users.sourceforge.jp", url = url("https://github.com/frsyuki")),
14+
Developer(id = "muga", name = "Muga Nishizawa", email = "muga.nishizawa@gmail.com", url = url("https://github.com/muga")),
15+
Developer(id = "oza", name = "Tsuyoshi Ozawa", email = "ozawa.tsuyoshi@gmail.com", url = url("https://github.com/oza")),
16+
Developer(id = "komamitsu", name = "Mitsunori Komatsu", email = "komamitsu@gmail.com", url = url("https://github.com/komamitsu")),
17+
Developer(id = "xerial", name = "Taro L. Saito", email = "leo@xerial.org", url = url("https://github.com/xerial"))
18+
)

0 commit comments

Comments
 (0)