From 978809330654ff6accfb71d257182f12a0f01664 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Tue, 24 Dec 2019 10:41:01 +0100 Subject: [PATCH] Enhance bump version script --- script/bump_version.clj | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/script/bump_version.clj b/script/bump_version.clj index a615989f..5addd96f 100755 --- a/script/bump_version.clj +++ b/script/bump_version.clj @@ -2,7 +2,8 @@ (ns bump-version (:require [clojure.java.io :as io] - [clojure.string :as str])) + [clojure.string :as str] + [clojure.java.shell :refer [sh]])) (def version-file (io/file "resources" "BABASHKA_VERSION")) (def released-version-file (io/file "resources" "BABASHKA_RELEASED_VERSION")) @@ -10,13 +11,18 @@ (case (first *command-line-args*) "release" (let [version-string (str/trim (slurp version-file)) [major minor patch] (str/split version-string #"\.") - patch (str/replace patch "-SNAPSHOT" "")] - (spit version-file (str/join "." [major minor patch]))) + patch (str/replace patch "-SNAPSHOT" "") + new-version (str/join "." [major minor patch])] + (spit version-file new-version) + (sh "git" "commit" "-a" "-m" (str "v" new-version)) + (println (:out (sh "git" "diff" "HEAD^" "HEAD")))) "post-release" (do (io/copy version-file released-version-file) (let [version-string (str/trim (slurp version-file)) [major minor patch] (str/split version-string #"\.") patch (Integer. patch) - patch (str (inc patch) "-SNAPSHOT")] - (spit version-file (str/join "." [major minor patch])))) + patch (str (inc patch) "-SNAPSHOT") + new-version (str/join "." [major minor patch])] + (spit version-file new-version) + (sh "git" "commit" "-a" "-m" "Version bump"))) (println "Expected: release | post-release."))