Skip to content

Commit

Permalink
release/v1.5.0 (#95)
Browse files Browse the repository at this point in the history
* tweak release.main.kts

- use git-switch instead of git-checkout

* revert version to 1.5.0-SNAPSHOT

* release 1.5.0
  • Loading branch information
aSemy authored Jun 14, 2023
1 parent 156d9a4 commit e3b85e4
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions devOps/release.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ object Release : CliktCommand() {
updateAndRelease(releaseVersion)

// Tag the release
git.checkout(startBranch)
git.switch(startBranch)
git.pull(startBranch)
require(currentVersion == releaseVersion) {
"incorrect version after update. Expected $releaseVersion but got $currentVersion"
Expand All @@ -90,7 +90,7 @@ object Release : CliktCommand() {
updateAndRelease(nextVersion)

// Go back and pull the changes
git.checkout(startBranch)
git.switch(startBranch)
git.pull(startBranch)

echo("Released version $releaseVersion")
Expand All @@ -100,7 +100,7 @@ object Release : CliktCommand() {
// checkout a release branch
val releaseBranch = "release/v$version"
echo("checkout out new branch...")
git.checkout(releaseBranch)
git.switch(releaseBranch, create = true)

// update the version & run tests
currentVersion = version
Expand All @@ -125,7 +125,16 @@ object Release : CliktCommand() {
/** git commands */
private val git = object {
val rootDir = File(runCommand("git rev-parse --show-toplevel", dir = null))
fun checkout(branch: String): String = runCommand("git checkout -b $branch")
fun switch(branch: String, create: Boolean = false): String {
return runCommand(
buildString {
append("git switch ")
if (create) append("--create ")
append(branch)
}
)
}

fun commit(message: String): String = runCommand("git commit -a -m \"$message\"")
fun currentBranch(): String = runCommand("git symbolic-ref --short HEAD")
fun pull(ref: String): String = runCommand("git pull origin $ref")
Expand Down

0 comments on commit e3b85e4

Please sign in to comment.