Update publish-docs to copy API docs to website

This commit is contained in:
Brandon Keepers 2017-08-18 10:55:11 -05:00
parent 9ed2744cfc
commit 36332f8c7b
No known key found for this signature in database
GPG Key ID: F9533396D5FACBF6
3 changed files with 17 additions and 15 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ node_modules/
*.pem
.env
out
tmp

View File

@ -1,6 +1,5 @@
{
"opts": {
"readme": "docs/plugins.md",
"template": "node_modules/minami"
},
"source": {

View File

@ -2,30 +2,32 @@
set -e
# Checkout the gh-pages branch into the "out" directory
[ -d ./out ] || git worktree add out origin/gh-pages
# Update checkout
cd out
git pull origin gh-pages
cd ..
# Store the versions
VERSION=$(npm view probot version)
# Generate docs
npm run doc
cd out
# Checkout the website into the tmp directory
[ -d tmp/website ] || {
mkdir -p tmp
git clone https://github.com/probot/probot.github.io tmp/website
}
# Update the website checkout
cd tmp/website
git pull origin master
# Delete previously generated docs for this version
rm -rf $VERSION
mv probot/$VERSION .
rmdir probot
rm -rf api/$VERSION
ln -sfn $VERSION latest
# Copy over the new docs
mv ../../out/probot/$VERSION api/$VERSION
ln -sfn $VERSION api/latest
# Commit and publish
git add .
git commit -m "Update docs for v$VERSION"
git push origin gh-pages
git tag v$VERSION
git push --tags origin master