release
This commit is contained in:
parent
5bbd4d199d
commit
7dd4af2ef4
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -11,3 +11,4 @@ node_modules/
|
||||||
resources/public/js
|
resources/public/js
|
||||||
.store
|
.store
|
||||||
gh-pages/
|
gh-pages/
|
||||||
|
gh-pages/
|
||||||
|
|
43
doc/dev.md
Normal file
43
doc/dev.md
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# Dev
|
||||||
|
|
||||||
|
## Release
|
||||||
|
|
||||||
|
Static files including compiled JS are hosted on Github. This is set up like
|
||||||
|
described
|
||||||
|
[here](https://medium.com/linagora-engineering/deploying-your-js-app-to-github-pages-the-easy-way-or-not-1ef8c48424b7):
|
||||||
|
|
||||||
|
All the commands below assume that you already have a git project initialized and that you are in its root folder.
|
||||||
|
|
||||||
|
```
|
||||||
|
# Create an orphan branch named gh-pages
|
||||||
|
git checkout --orphan gh-pages
|
||||||
|
# Remove all files from staging
|
||||||
|
git rm -rf .
|
||||||
|
# Create an empty commit so that you will be able to push on the branch next
|
||||||
|
git commit --allow-empty -m "Init empty branch"
|
||||||
|
# Push the branch
|
||||||
|
git push origin gh-pages
|
||||||
|
```
|
||||||
|
|
||||||
|
Now that the branch is created and pushed to origin, let’s configure the worktree correctly:
|
||||||
|
|
||||||
|
```
|
||||||
|
# Come back to master
|
||||||
|
git checkout main
|
||||||
|
# Add gh-pages to .gitignore
|
||||||
|
echo "gh-pages/" >> .gitignore
|
||||||
|
git worktree add gh-pages gh-pages
|
||||||
|
```
|
||||||
|
|
||||||
|
After cloning this repo to a new dir:
|
||||||
|
|
||||||
|
```
|
||||||
|
git fetch origin gh-pages
|
||||||
|
git worktree add gh-pages gh-pages
|
||||||
|
```
|
||||||
|
|
||||||
|
To deploy to Github Pages:
|
||||||
|
|
||||||
|
```
|
||||||
|
script/release
|
||||||
|
```
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
clojure -A:dev -m shadow.cljs.devtools.cli release main
|
clojure -M:dev -m shadow.cljs.devtools.cli release main
|
||||||
cp resources/public/index.html gh-pages
|
cp resources/public/index.html gh-pages
|
||||||
cp resources/public/xterm.css gh-pages
|
sed -i 's/main.js/sci_script_tag.js/' gh-pages/index.html
|
||||||
|
|
||||||
mkdir -p gh-pages/ui
|
mkdir -p gh-pages/js
|
||||||
cp resources/public/ui/main.js gh-pages/ui/main.js
|
cp resources/public/js/main.js gh-pages/js/sci_script_tag.js
|
||||||
|
|
||||||
cd gh-pages
|
cd gh-pages
|
||||||
git add .
|
git add .
|
||||||
|
|
22
script/release.clj
Executable file
22
script/release.clj
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/usr/bin/env bb
|
||||||
|
|
||||||
|
(require '[babashka.fs :as fs]
|
||||||
|
'[babashka.tasks :refer [shell]]
|
||||||
|
'[clojure.string :as str])
|
||||||
|
|
||||||
|
;; (fs/copy "resources/public/index.html" "gh-pages"
|
||||||
|
;; {:replace-existing true})
|
||||||
|
;; (shell "clojure -M:dev -m shadow.cljs.devtools.cli release main")
|
||||||
|
;; (def index-file (fs/file "gh-pages" "index.html"))
|
||||||
|
;; (spit index-file (str/replace (slurp index-file) "main.js" "sci_script_tag.js"))
|
||||||
|
;; (fs/create-dirs (fs/file "gh-pages" "js"))
|
||||||
|
;; (fs/copy (fs/file "resources" "public" "js" "main.js")
|
||||||
|
;; (fs/file "gh-pages" "js" "sci_script_tag.js")
|
||||||
|
;; {:replace-existing true})
|
||||||
|
|
||||||
|
(def with-gh-pages (partial shell {:dir "gh-pages"}))
|
||||||
|
#_(with-gh-pages "git add .")
|
||||||
|
#_(with-gh-pages "git commit -m 'update build'")
|
||||||
|
(with-gh-pages "git push origin gh-pages")
|
||||||
|
|
||||||
|
nil
|
Loading…
Reference in a new issue