forked from clojure/contrib-api-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·52 lines (44 loc) · 1.33 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
set -e
# TODO - remove
PROJECT=spec.alpha
# Create or refresh repo
if [[ ! -d repo ]]; then
echo "Creating new repo area"
git clone "git@github.com:clojure/$PROJECT.git" repo
else
echo "Refreshing repo area"
(cd repo && git fetch && git reset --hard)
fi
version="$(cd repo && mvn -q -N org.codehaus.mojo:exec-maven-plugin:1.3.1:exec -Dexec.executable='echo' -Dexec.args='${project.version}' | tail -1)"
echo "version=$version"
# Create or clean output directory
if [[ ! -d repo-docs ]]; then
echo "Creating new gh-pages area"
git clone "git@github.com:clojure/$PROJECT.git" repo-docs
(cd repo-docs && git checkout gh-pages)
else
echo "Refreshing gh-pages area"
(cd repo-docs && git fetch && git reset --hard)
fi
rm -rf repo-docs/*
# Copy stable site files
echo "Copying static site files"
cp -R site/* repo-docs
# Run autodoc-collect
echo "Analyzing $PROJECT"
rm -f analysis.edn
echo "(def PROJECT \"$PROJECT\") (def VERSION \"$version\")" > proj.clj
cat proj.clj collect.clj | clojure -J-Dclojure.spec.skip-macros=true -C:collect -
# Run autodoc
echo "Building $PROJECT"
cat proj.clj build.clj | clojure -R:build -
# Commit
if [[ ! -z "$COMMIT" ]]; then
echo "Committing updated gh-pages branch"
cd repo-docs
git add -u -v
git commit -m "Autodoc commit"
git config --global push.default simple
git push
fi