2020-04-20 07:59:49 +00:00
|
|
|
(require '[babashka.curl :as curl]
|
|
|
|
|
'[cheshire.core :refer [generate-string]]
|
2020-01-09 13:32:25 +00:00
|
|
|
'[clojure.java.io :as io]
|
|
|
|
|
'[clojure.string :as str])
|
2020-01-07 15:38:54 +00:00
|
|
|
|
|
|
|
|
(def channel "#babashka_circleci_builds")
|
|
|
|
|
#_(def channel "#_test")
|
2020-01-09 13:32:25 +00:00
|
|
|
(def babashka-version (str/trim (slurp (io/file "resources" "BABASHKA_VERSION"))))
|
2020-03-29 11:05:27 +00:00
|
|
|
(def slack-hook-url (System/getenv "SLACK_HOOK_URL"))
|
2020-01-07 15:38:54 +00:00
|
|
|
|
2020-03-29 11:05:27 +00:00
|
|
|
(defn slack! [text]
|
|
|
|
|
(when slack-hook-url
|
|
|
|
|
(let [json (generate-string {:username "borkdude"
|
|
|
|
|
:channel channel
|
|
|
|
|
:text text})]
|
2020-04-20 07:59:49 +00:00
|
|
|
(curl/post slack-hook-url {:headers {"content-type" "application/json"}
|
|
|
|
|
:body json}))))
|
2020-01-07 15:38:54 +00:00
|
|
|
|
2020-03-29 11:05:27 +00:00
|
|
|
(def release-text (format "[%s - %s@%s]: https://%s-201467090-gh.circle-artifacts.com/0/release/babashka-%s-%s-amd64.zip"
|
|
|
|
|
(System/getenv "BABASHKA_PLATFORM")
|
|
|
|
|
(System/getenv "CIRCLE_BRANCH")
|
|
|
|
|
(System/getenv "CIRCLE_SHA1")
|
|
|
|
|
(System/getenv "CIRCLE_BUILD_NUM")
|
|
|
|
|
babashka-version
|
|
|
|
|
(System/getenv "BABASHKA_PLATFORM")))
|
|
|
|
|
|
|
|
|
|
(slack! release-text)
|
|
|
|
|
|
|
|
|
|
(def binary-size-text
|
|
|
|
|
(format "[%s - %s@%s] binary size: %s"
|
|
|
|
|
(System/getenv "BABASHKA_PLATFORM")
|
|
|
|
|
(System/getenv "CIRCLE_BRANCH")
|
|
|
|
|
(System/getenv "CIRCLE_SHA1")
|
|
|
|
|
(slurp (io/file "/tmp/bb_size/size"))))
|
|
|
|
|
|
|
|
|
|
(slack! binary-size-text)
|