diff --git a/.circleci/script/publish_artifact.clj b/.circleci/script/publish_artifact.clj index 1b5f5b74..6b0a75e9 100755 --- a/.circleci/script/publish_artifact.clj +++ b/.circleci/script/publish_artifact.clj @@ -1,23 +1,35 @@ -(require '[clojure.java.shell :refer [sh]] +(require '[cheshire.core :refer [generate-string]] '[clojure.java.io :as io] - '[cheshire.core :refer [generate-string]] + '[clojure.java.shell :refer [sh]] '[clojure.string :as str]) (def channel "#babashka_circleci_builds") #_(def channel "#_test") (def babashka-version (str/trim (slurp (io/file "resources" "BABASHKA_VERSION")))) - -(def 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"))) - (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))) + +(defn slack! [text] + (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)))) + +(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) diff --git a/.circleci/script/release b/.circleci/script/release index 2d32f514..5e6325bf 100755 --- a/.circleci/script/release +++ b/.circleci/script/release @@ -8,6 +8,8 @@ cp bb /tmp/release VERSION=$(cat resources/BABASHKA_VERSION) cd /tmp/release +mkdir -p /tmp/bb_size +./bb '(spit "/tmp/bb_size/size" (.length (io/file "bb")))' ## release binary as zip archive