babashka/.circleci/script/publish_artifact.clj

24 lines
1 KiB
Clojure
Raw Normal View History

2020-01-07 15:38:54 +00:00
(require '[clojure.java.shell :refer [sh]]
2020-01-09 13:32:25 +00:00
'[clojure.java.io :as io]
'[cheshire.core :refer [generate-string]]
'[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-01-07 15:38:54 +00:00
2020-01-09 13:32:25 +00:00
(def text (format "[%s - %s@%s]: https://%s-201467090-gh.circle-artifacts.com/0/release/babashka-%s-%s-amd64.zip"
2020-01-07 15:38:54 +00:00
(System/getenv "BABASHKA_PLATFORM")
(System/getenv "CIRCLE_BRANCH")
(System/getenv "CIRCLE_SHA1")
(System/getenv "CIRCLE_BUILD_NUM")
2020-01-09 13:32:25 +00:00
babashka-version
2020-01-07 15:38:54 +00:00
(System/getenv "BABASHKA_PLATFORM")))
(def slack-hook-url (System/getenv "SLACK_HOOK_URL"))
(when slack-hook-url
(let [json (generate-string {:username "borkdude"
:channel channel
:text text})]
(sh "curl" "-X" "POST" "-H" "Content-Type: application/json" "-d" json slack-hook-url)))