Skip to content

Commit 69125f9

Browse files
committed
modified release procedure to publish to sonatype
1 parent b646b9f commit 69125f9

File tree

2 files changed

+42
-30
lines changed

2 files changed

+42
-30
lines changed

.github/workflows/release.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,17 @@ jobs:
2828
git config user.name "${{ secrets.GIT_USERNAME }}" &&
2929
git config user.email "${{ secrets.GIT_USER_EMAIL }}"
3030
- name: Release the specified version
31+
env:
32+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
33+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
3134
if: ${{ github.event.inputs.release_version != '' }}
32-
run: sbt "preRelease ${{ github.event.inputs.release_version }}"
35+
run: sbt "preRelease ${{ github.event.inputs.release_version }} ${{ secrets.GPG_KEY_ID }}"
3336
- name: Release new version
37+
env:
38+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
39+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
3440
if: ${{ github.event.inputs.release_version == '' }}
35-
run: sbt "preRelease next"
41+
run: sbt "preRelease next ${{ secrets.GPG_KEY_ID }}"
3642
- name: Latest tag
3743
uses: actions-ecosystem/action-get-latest-tag@v1
3844
id: latest-tag

build.sbt

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -118,36 +118,42 @@ scalacOptions ++= Seq(
118118
"-feature",
119119
)
120120

121-
commands += Command.single("preRelease") { (state, nextVersion) =>
122-
val newState = Project
123-
.extract(state)
124-
.appendWithSession(
125-
Seq(
126-
releaseProcess := Seq(
127-
checkSnapshotDependencies,
128-
inquireVersions,
129-
runClean,
130-
runTest,
131-
setReleaseVersion,
132-
releaseStepTask(assembly),
133-
commitReleaseVersion,
134-
tagRelease,
135-
releaseStepCommandAndRemaining("publishSigned"),
136-
releaseStepCommand("sonatypeBundleRelease"),
137-
pushChanges,
121+
commands += Command.args("preRelease", "<arg>") { (state, args) =>
122+
args match {
123+
case Seq(nextVersion, pgpKeyId) =>
124+
val newState = Project
125+
.extract(state)
126+
.appendWithSession(
127+
Seq(
128+
releaseProcess := Seq(
129+
checkSnapshotDependencies,
130+
inquireVersions,
131+
runClean,
132+
runTest,
133+
setReleaseVersion,
134+
releaseStepTask(assembly),
135+
commitReleaseVersion,
136+
tagRelease,
137+
releaseStepCommandAndRemaining("publishSigned"),
138+
releaseStepCommand("sonatypeBundleRelease"),
139+
pushChanges,
140+
),
141+
usePgpKeyHex(pgpKeyId),
142+
),
143+
state,
138144
)
139-
),
140-
state,
141-
)
142-
143-
if (nextVersion == "next")
144-
Command.process("release with-defaults", newState)
145-
else
146-
Command.process(
147-
s"release with-defaults release-version $nextVersion",
148-
newState,
149-
)
150145

146+
if (nextVersion == "next")
147+
Command.process("release with-defaults", newState)
148+
else
149+
Command.process(
150+
s"release with-defaults release-version $nextVersion",
151+
newState,
152+
)
153+
case other =>
154+
println("wrong number of arguments passed!")
155+
state
156+
}
151157
}
152158

153159
commands += Command.command("postRelease") { state =>

0 commit comments

Comments
 (0)