Skip to content

Commit 557ab0a

Browse files
committed
[ci] Fix build
1 parent cb4c652 commit 557ab0a

File tree

4 files changed

+47
-16
lines changed

4 files changed

+47
-16
lines changed

.github/workflows/continuous-deployment-workflow.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ jobs:
9696
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
9797
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }}
9898
CLOJARS_TOKEN: ${{ secrets.CLOJARS_TOKEN }}
99+
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_TOKEN }}
99100
GITHUB_USERNAME: ${{ github.actor }}
100101
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101102

bb.edn

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,36 @@
11
{:min-bb-version "0.4.0"
22
:tasks
3-
{:requires ([babashka.fs :as fs])
3+
{:requires ([babashka.fs :as fs]
4+
[clojure.string :as str])
5+
:init (do
6+
(defn release-tag [& {:keys [dir]}]
7+
(->> (shell {:out :string
8+
:dir dir}
9+
"git tag -l --sort=v:refname")
10+
:out
11+
str/split-lines
12+
(filter (fn [s]
13+
(re-find (re-pattern "^v\\d+\\.\\d+\\.\\d+$") s)))
14+
last
15+
str/trim))
16+
(defn release-hash [& {:keys [dir] :as opts}]
17+
(->> (release-tag opts)
18+
(str "git rev-parse --short ")
19+
(shell {:out :string :dir dir})
20+
:out
21+
str/trim))
22+
(defn latest-hash [& {:keys [dir]}]
23+
(->> "git log -1 --format=%h"
24+
(shell {:out :string :dir dir})
25+
:out
26+
str/trim))
27+
(def opts (let [tag (release-tag)
28+
latest-hash (latest-hash)
29+
release-hash (release-hash)]
30+
{:extra-env {"DAY8_RELEASE_TAG" tag
31+
"RE_COM_VERSION" (cond-> tag
32+
(not= release-hash latest-hash)
33+
(str "--" latest-hash))}})))
434
clean (let [clean-targets ["node_modules"
535
"run/resources/public/compiled_dev "
636
"run/resources/public/compiled_prod"
@@ -10,26 +40,26 @@
1040
(fs/delete-tree target)))
1141
install (shell "npm install")
1242
test {:depends [clean install]
13-
:task (do (shell "npx shadow-cljs compile karma-test")
14-
(shell "npx karma start --single-run --reporters junit,dots"))}
43+
:task (do (shell opts "npx shadow-cljs compile karma-test")
44+
(shell opts "npx karma start --single-run --reporters junit,dots"))}
1545
jar {:depends [clean]
16-
:task (shell "clojure -T:build jar")}
46+
:task (shell opts "clojure -T:build jar")}
1747
release-clojars {:depends [jar]
18-
:task (shell "clojure -T:build clojars")}
48+
:task (shell opts "clojure -T:build clojars")}
1949
release-demo {:depends [clean install]
20-
:task (shell "npx shadow-cljs release demo")}
21-
ci {:depends [install test clean install release-demo]}
50+
:task (shell opts "npx shadow-cljs release demo")}
51+
ci (do (run 'test) (run 'release-demo))
2252
build-report-ci {:depends [install]
23-
:task (shell "npx shadow-cljs clj-run shadow.cljs.build-report demo"
53+
:task (shell opts "npx shadow-cljs clj-run shadow.cljs.build-report demo"
2454
"target/build-report.html")}
2555
watch {:depends [install]
26-
:task (shell "npx shadow-cljs watch demo browser-test karma-test")}
56+
:task (shell opts "npx shadow-cljs watch demo browser-test karma-test")}
2757
watch-demo {:depends [install]
28-
:task (shell "npx shadow-cljs watch demo")}
58+
:task (shell opts "npx shadow-cljs watch demo")}
2959
browser-test {:depends [install]
30-
:task (shell "npx shadow-cljs watch browser-test")}
60+
:task (shell opts "npx shadow-cljs watch browser-test")}
3161
deploy-aws {:depends [ci]
32-
:task (shell "aws s3 sync run/resources/public s3://re-demo/ --acl"
62+
:task (shell opts "aws s3 sync run/resources/public s3://re-demo/ --acl"
3363
"public-read"
3464
"--cache-control"
3565
"max-age=2592000,public")}}}

build.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[clojure.tools.build.api :as b]))
44

55
(def lib 're-com/re-com)
6-
(def version (System/getenv "DAY8_APP_VERSION"))
6+
(def version (System/getenv "DAY8_RELEASE_TAG"))
77
(def main-ns 're-com.core)
88
(def class-dir "target/classes")
99
(def basis (delay (b/create-basis {})))

shadow-cljs.edn

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{:target :browser
66
:modules {:demo {:init-fn re-demo.core/mount-demo}}
77
:build-hooks [(shadow-git-inject.core/hook)]
8-
:compiler-options {:closure-defines {re-com.config/version :shadow-git-inject/version
8+
:compiler-options {:closure-defines {re-com.config/version #env "RE_COM_VERSION"
99
;; For production builds of the demo app, set goog.DEBUG
1010
;; to be true so that the debugging demo page works as expected.
1111
goog.DEBUG true
@@ -36,7 +36,7 @@
3636
:browser-test {:target :browser-test
3737
:ns-regexp "-test$"
3838
:test-dir "run/resources/public/compiled_test/demo"
39-
:compiler-options {:closure-defines {re-com.config/version :shadow-git-inject/version}
39+
:compiler-options {:closure-defines {re-com.config/version #env "RE_COM_VERSION"}
4040
:externs ["externs/detect-element-resize-externs.js"]
4141
:external-config {:devtools/config {:features-to-install [:formatters :hints]}}}
4242
:devtools {:http-port 8021
@@ -46,5 +46,5 @@
4646
:ns-regexp ".*-test$"
4747
:output-to "target/karma/test.js"
4848
:compiler-options {:pretty-print true
49-
:closure-defines {re-com.config/version :shadow-git-inject/version}
49+
:closure-defines {re-com.config/version #env "RE_COM_VERSION"}
5050
:externs ["externs/detect-element-resize-externs.js"]}}}}

0 commit comments

Comments
 (0)