Skip to content

Commit 61d3ca4

Browse files
committed
add tag task
1 parent eff1bd5 commit 61d3ca4

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

bb.edn

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
:deps {borkdude/gh-release-artifact {:git/url "https://github.com/borkdude/gh-release-artifact"
33
:git/sha "4a9a74f0e50e897c45df8cc70684360eb30fce80"}}
44
:min-bb-version "0.8.156"
5-
:tasks {debug-cli make/debug-cli
5+
:tasks {tag make/tag
6+
debug-cli make/debug-cli
67
prod-jar make/prod-jar
78
native-cli make/native-cli}}

scripts/make.clj

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,24 @@
22
(:require
33
[babashka.deps :as deps]
44
[babashka.fs :as fs]
5-
[babashka.process :as p]))
5+
[babashka.process :as p]
6+
[babashka.tasks :refer [shell]]
7+
[clojure.string :as string]))
68

79
(def windows? (#'fs/windows?))
810

11+
(defn ^:private replace-in-file [file regex content]
12+
(as-> (slurp file) $
13+
(string/replace $ regex content)
14+
(spit file $)))
15+
16+
(defn ^:private add-changelog-entry [tag comment]
17+
(replace-in-file "CHANGELOG.md"
18+
#"## Unreleased"
19+
(if comment
20+
(format "## Unreleased\n\n## %s\n\n- %s" tag comment)
21+
(format "## Unreleased\n\n## %s" tag))))
22+
923
(defn ^:private mv-here [file]
1024
(fs/move file "." {:replace-existing true}))
1125

@@ -37,3 +51,15 @@
3751
[]
3852
(build "native-cli")
3953
(mv-here (fs/path (eca-bin-filename :native))))
54+
55+
(defn tag [& [tag]]
56+
(shell "git fetch origin")
57+
(shell "git pull origin HEAD")
58+
(spit "resources/ECA_VERSION" tag)
59+
(add-changelog-entry tag nil)
60+
(prod-jar)
61+
(shell "git add resources/ECA_VERSION CHANGELOG.md")
62+
(shell (format "git commit -m \"Release: %s\"" tag))
63+
(shell (str "git tag " tag))
64+
(shell "git push origin HEAD")
65+
(shell "git push origin --tags"))

0 commit comments

Comments
 (0)