From aa63ec0370268c8464bf10e734be983ebafa5a37 Mon Sep 17 00:00:00 2001 From: Max Penet Date: Thu, 18 Jul 2024 14:49:48 +0200 Subject: [PATCH] add another version-fn (matching blockstorage) --- src/exoscale/tools/project/api/version.clj | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/exoscale/tools/project/api/version.clj b/src/exoscale/tools/project/api/version.clj index 649a5ba..d7d0119 100644 --- a/src/exoscale/tools/project/api/version.clj +++ b/src/exoscale/tools/project/api/version.clj @@ -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)))