Skip to content

Commit 422b8d7

Browse files
authored
Merge pull request #367 from sbt/wip/snapshot
fix: Fixes SNAPSHOT publishing
2 parents ed0f232 + 4868ff4 commit 422b8d7

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,21 @@ object CiReleasePlugin extends AutoPlugin {
178178
val publishCommand = getPublishCommand(currentState)
179179

180180
if (!isTag) {
181-
println(
182-
s"No tag published. Cannot publish an official release without a tag and Sonatype Central does not accept snapshot releases. Aborting release."
183-
)
184-
currentState
181+
if (isSnapshot) {
182+
println(s"No tag push, publishing SNAPSHOT")
183+
reloadKeyFiles ::
184+
sys.env.getOrElse("CI_CLEAN", "; clean") ::
185+
publishCommand ::
186+
sys.env.getOrElse("CI_SNAPSHOT_RELEASE", "sonaRelease") ::
187+
currentState
188+
} else {
189+
// Happens when a tag is pushed right after merge causing the main branch
190+
// job to pick up a non-SNAPSHOT version even if TRAVIS_TAG=false.
191+
println(
192+
"Snapshot releases must have -SNAPSHOT version number, doing nothing"
193+
)
194+
currentState
195+
}
185196
} else {
186197
println("Tag push detected, publishing a stable release")
187198
reloadKeyFiles ::

0 commit comments

Comments
 (0)