Rewrite bash script in bb

This commit is contained in:
Michiel Borkent 2020-01-07 16:38:54 +01:00
parent ece81e0a99
commit bf481b76d1
3 changed files with 21 additions and 7 deletions

View file

@ -135,7 +135,7 @@ jobs:
- run:
name: Publish artifact link to Slack
command: |
.circleci/script/publish_artifact
./bb .circleci/script/publish_artifact
mac:
macos:
xcode: "9.0"
@ -203,7 +203,7 @@ jobs:
- run:
name: Publish artifact link to Slack
command: |
.circleci/script/publish_artifact
./bb .circleci/script/publish_artifact
deploy:
docker:
- image: circleci/clojure:lein-2.8.1

View file

@ -1,5 +0,0 @@
#!/usr/bin/env bash
channel="#babashka_circleci_builds"
text="[$BABASHKA_PLATFORM - $CIRCLE_BRANCH@$CIRCLE_SHA1]: https://$CIRCLE_BUILD_NUM-201467090-gh.circle-artifacts.com/0/release/babashka-0.0.61-SNAPSHOT-$BABASHKA_PLATFORM-amd64.zip"
curl -X POST -H "Content-Type: application/json" -d '{"username":"borkdude", "channel":'\""$channel\""', "text":'"\"$text\""'}' $SLACK_HOOK_URL

View file

@ -0,0 +1,19 @@
(require '[clojure.java.shell :refer [sh]]
'[cheshire.core :refer [generate-string]])
(def channel "#babashka_circleci_builds")
#_(def channel "#_test")
(def text (format "[%s - %s@%s]: https://%s-201467090-gh.circle-artifacts.com/0/release/babashka-0.0.61-SNAPSHOT-%s-amd64.zip"
(System/getenv "BABASHKA_PLATFORM")
(System/getenv "CIRCLE_BRANCH")
(System/getenv "CIRCLE_SHA1")
(System/getenv "CIRCLE_BUILD_NUM")
(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)))