如何从mongod.conf
文件中增加项目版本号,以便在编译时自动将其上传到git?
答案 0 :(得分:4)
sbt-release
插件将为您完成所有这些工作。
如果您从命令行发出命令sbt release
,则此插件将删除-SNAPSHOT
后缀,标记,提交并将更改推送到存储库,构建,测试和发布工件,然后更新版本版本号(再次添加-SNAPSHOT
后缀),再次提交更改。
可以根据需要自定义以上所有步骤。
答案 1 :(得分:1)
您可以使用 sbt-release 插件。
步骤
plugins.sbt
) 创建一个 ./project/plugins.sbt
文件。addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13")
文件中添加最新的 plugins.sbt
插件。build.sbt
文件中添加以下内容。import ReleaseTransformations._
releaseVersionBump := sbtrelease.Version.Bump.Next
releaseVersionFile := baseDirectory.value / "version.sbt"
publishConfiguration := publishConfiguration.value.withOverwrite(true)
releaseIgnoreUntrackedFiles := true
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies, // : ReleaseStep
inquireVersions, // : ReleaseStep
runClean, // : ReleaseStep
runTest, // : ReleaseStep
setReleaseVersion, // : ReleaseStep
commitReleaseVersion, // : ReleaseStep, performs the initial git checks
tagRelease, // : ReleaseStep
publishArtifacts, // : ReleaseStep, checks whether `publishTo` is properly set up
releaseStepTask(publish in Docker), // : ReleaseStep, publish the docker image in your specified repository(e.i. Nexus)
setNextVersion, // : ReleaseStep
commitNextVersion, // : ReleaseStep
pushChanges // : ReleaseStep, also checks that an upstream branch is properly configured
)
version.sbt
文件。version in ThisBuild := "1.0.0-SNAPSHOT"
文件中添加此 version.sbt
。sbt release
或 sbt 'release with-defaults'
)注意:
releaseStepTask(publish in Docker)
中添加了 ReleaseStep
以在您指定的存储库(例如 Nexus)中自动构建/推送 docker 镜像。releaseStepTask(publish in Docker)
步骤,您需要在 addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.7.6")
文件中添加一个 sbt-native-packager(plugins.sbt
)。