Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support major.minor bumps #82

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.2.x
26 changes: 19 additions & 7 deletions build.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,24 @@
(def github-url "https://github.com/metabase/macaw")
(def scm-url "[email protected]:metabase/macaw.git")

(def major-minor-version "0.1")
(def version-template (str/trim (slurp "VERSION")))
(assert (re-matches #"\d+\.\d+\.x" version-template))

(def major-minor-version (str/replace version-template #"\.x$" ""))

(defn sh [& args]
(let [{:keys [exit out]} (apply sh/sh args)]
(assert (zero? exit))
(str/trim out)))

(defn- commits-since-version-changed []
(let [last-sha (sh "git" "log" "-1" "--format=%H" "--" "VERSION")]
(parse-long (sh "git" "rev-list" "--count" (str last-sha "..HEAD")))))

(defn commit-number []
(or (-> (sh/sh "git" "rev-list" "HEAD" "--count")
:out
str/trim
parse-long)
"9999-SNAPSHOT"))
(if (= "master" (sh "git" "rev-parse" "--abbrev-ref" "HEAD"))
(str major-minor-version "." (commits-since-version-changed))
"9999-SNAPSHOT"))

(def sha
(or (not-empty (System/getenv "GITHUB_SHA"))
Expand All @@ -44,7 +54,9 @@
[:url "http://www.eclipse.org/legal/epl-v10.html"]]]
[:developers
[:developer
[:name "Tim Macdonald"]]]
[:name "Tim Macdonald"]]
[:developer
[:name "Chris Truter"]]]
[:scm
[:url github-url]
[:connection (str "scm:git:" scm-url)]
Expand Down
Loading