Skip to content

Commit ef382a3

Browse files
committed
Automatically generate API documentation on each release.
1 parent 36160e8 commit ef382a3

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ pom.xml.asc
99
/.nrepl-port
1010
.hgignore
1111
.hg/
12+
doc/api

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ parts to this library:
1717
should use this if you're transitioning code from `clj-ssh` to this
1818
library.
1919

20+
Documentation for the latest release should always be available at:
21+
http://conormcd.github.io/clj-libssh2/
22+
2023
## clj-libssh2 API
2124

2225
The primary public API for this library is the following set of functions:

project.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
:username [:gpg :env/clojars_username]
1212
:password [:gpg :env/clojars_password]
1313
:sign-releases false}]]
14+
:codox {:output-path "doc/api"}
1415
:jvm-opts ["-Xmx1g"
1516
"-XX:+TieredCompilation"
1617
"-XX:TieredStopAtLevel=1"])

release.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,29 @@ save_artifacts() {
8585
fi
8686
}
8787

88+
update_api_docs() {
89+
local _version
90+
_version=$1
91+
92+
set -x
93+
git config --global user.email "${GITHUB_USER}@users.noreply.github.com"
94+
git config --global user.name "${GITHUB_USER}/${GITHUB_REPO} release.sh"
95+
git clone -b gh-pages [email protected]:${GITHUB_USER}/${GITHUB_REPO}.git doc/api
96+
lein codox
97+
(
98+
cd doc/api
99+
cat > circle.yml <<EOF
100+
general:
101+
branches:
102+
ignore:
103+
- gh-pages
104+
EOF
105+
git add .
106+
git commit -m "Docs for version ${_version}"
107+
git push origin gh-pages
108+
)
109+
}
110+
88111
ensure_github_release_tool_installed() {
89112
local _cwd
90113
_cwd=$(pwd)
@@ -124,6 +147,10 @@ clojars_deploy() {
124147
lein deploy clojars 2>&1 | sed -e 's,^, ,'
125148
}
126149

150+
cleanup() {
151+
git clean -ffdx
152+
}
153+
127154
v=$(new_version)
128155
update_project_clj "${v}"
129156
build_jars
@@ -145,4 +172,8 @@ if [ "$(branch)" = "master" ]; then
145172

146173
# Push to clojars
147174
clojars_deploy
175+
176+
# Push new docs
177+
update_api_docs "${v}"
148178
fi
179+
cleanup

0 commit comments

Comments
 (0)