I managed to set up sbt-release in my CI pipeline to publish a release artifact (e.g. v0.0.1). From that point in time, I can add local changes and the build versions change to snapshot along with my commits (v0.0.1-1-SHA1-SNAPSHOT). At this stage, how can I publish a snapshot artifact without releasing? I mean, I may not want to release v.0.0.2 at this stage, I only want to publish a snapshot. Also, I want to do that in such a way the version format is preserved and I do not need to manually input the version.
            Asked
            
        
        
            Active
            
        
            Viewed 6,304 times
        
    5
            
            
        - 
                    My basic setup follows http://blog.byjean.eu/2015/07/10/painless-release-with-sbt.html – Andrea T. Bonanno Feb 28 '17 at 16:37
 
1 Answers
6
            
            
        Eventually I responded to my requirements by using separate "sbt release" command for publishing a release artifact and "sbt publish" to publish a snapshot artifact. I also needed to set the publish location in the build.sbt file as follows.
publishTo <<= version { v: String =>
 val nexus: String = "https://xxxxxxxx/repository/"
 if (v.trim.endsWith("SNAPSHOT"))
   Some("Snapshots" at nexus + "snapshots")
 else
   Some("Releases" at nexus + "releases")
}
From the "sbt-release" section of the linked posted in my comment
Below is a sample release process for an application, to switch it to a library you would uncomment the publishArtifacts and comment the next line which is used to publish the package from the Universal namespace.
releaseProcess := Seq(
  checkSnapshotDependencies,
  inquireVersions,
  setReleaseVersion,
  runTest,
  tagRelease,
 // publishArtifacts,
  ReleaseStep(releaseStepTask(publish in Universal)),
  pushChanges
)
        Andrea T. Bonanno
        
- 221
 - 1
 - 4
 - 15
 
- 
                    Can you elaborate more on how you added added 'sbt publish' task? – Tushar Sudake Sep 08 '17 at 18:19
 - 
                    @TusharSudake as described in the "sbt-release" section from the link I posted, I added the publish step to the release process. Please see my updated answer above. – Andrea T. Bonanno Sep 13 '17 at 09:37