merge to master with sbt release-plugin

I’m trying to release my sbt project using sbt-release plugin.
When I execute ‘sbt release ‘ task on the develop brunch, it creates a new tag based on this branch, but doesn’t merge changes from the current develop branch to the master.
Is it possible to merge all changes made in develop branch to the master while releasing?

I need something like this:

  • Able to recover a deleted branch using git tag
  • FreeBSD cURL CVE fixing
  • Git clone fails with out of memory error - “fatal: out of memory, malloc failed (tried to allocate 905574791 bytes) / fatal: index-pack failed”
  • How to get rid of Git submodules untracked status?
  • How to force the checkout of the latest revision from a remote server?
  • SCM sync not working
    1. Change the project version to release version and push those changes to the remote develop branch.
    2. Merge the latest develop commit to the master branch and tag it.
    3. Change the version number to the next snapshot and push those changes back to the remote develop.

    So how can I achieve this behaviour?

  • How to do a “git checkout -b <branchname>” from a remote tag
  • Git search history and show diff
  • initializing repo
  • Redo part of an already committed merge
  • Git switch branch with Visual Studio 2015 causes changes
  • Informative message for reverting multiple git commits
  • One Solution collect form web for “merge to master with sbt release-plugin”

    You can do it by changing the release process with your own custom steps.
    Basically I just copied the steps from the sbt-release code, and added some of mine own

    lazy val deploySettings: Seq[Def.Setting[_]] = {
      import ReleaseTransformations._
      import ReleasePlugin.autoImport._
      import sbtrelease.{Git, Utilities, ExtraReleaseCommands}
      import Utilities._
      val deployBranch = "master"
      def merge: (State) => State = { st: State =>
        val git = st.extract.get(releaseVcs).get.asInstanceOf[Git]
        val curBranch = (git.cmd("rev-parse", "--abbrev-ref", "HEAD") !!).trim
        st.log.info(s"####### current branch: $curBranch")
        git.cmd("checkout", deployBranch) ! st.log
        st.log.info(s"####### pull $deployBranch")
        git.cmd("pull") ! st.log
        st.log.info(s"####### merge")
        git.cmd("merge", curBranch, "--no-ff", "--no-edit") ! st.log
        st.log.info(s"####### push")
        git.cmd("push", "origin", s"$deployBranch:$deployBranch") ! st.log
        st.log.info(s"####### checkout $curBranch")
        git.cmd("checkout", curBranch) ! st.log
        st
      }
      lazy val mergeReleaseVersionAction = { st: State =>
        val newState = merge(st)
        newState
      }
      val mergeReleaseVersion = ReleaseStep(mergeReleaseVersionAction)
      publishingSettings ++
        Seq(
          releaseProcess := Seq[ReleaseStep](
            checkSnapshotDependencies,
            inquireVersions,
            runClean,
            runTest,
            setReleaseVersion,
            commitReleaseVersion,
            pushChanges,                //to make sure develop branch is pulled
            mergeReleaseVersion,        //will merge into master and push
            tagRelease,
            setNextVersion,
            commitNextVersion,
            pushChanges
          )
        )
    }
    

    it assumes that you are using git

    not very pretty, but it works.

    Git Baby is a git and github fan, let's start git clone.