Skip to content

Commit

Permalink
add another version-fn (matching blockstorage)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenet committed Jul 18, 2024
1 parent f1230d6 commit aa63ec0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/exoscale/tools/project/api/version.clj
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,16 @@
:suffix version-suffix}))

(defn git-count-revs
"To be used via version-fn, returns version as VERSION_TEMPLATE with number of
commits on current branch replacing the GENERATED_VERSION placeholder"
[{:as _opts :exoscale.project/keys [version-template-file]
:or {version-template-file "VERSION_TEMPLATE"}}]
(str/replace (slurp (td/canonicalize (io/file version-template-file)))
"GENERATED_VERSION"
(b/git-count-revs nil)))

(defn epoch
"To be used via version-fn, returns version as VERSION_TEMPLATE with number of
seconds since epoch replacing the GENERATED_VERSION placeholder"
[_opts]
(.getEpochSecond (java.time.Instant/now)))

0 comments on commit aa63ec0

Please # to comment.