From 36332f8c7b5febe707eb44ecc9c2c3cc8ae698c5 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 18 Aug 2017 10:55:11 -0500 Subject: [PATCH] Update publish-docs to copy API docs to website --- .gitignore | 1 + .jsdoc.json | 1 - script/publish-docs | 30 ++++++++++++++++-------------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 12937d6f..716fc142 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ node_modules/ *.pem .env out +tmp diff --git a/.jsdoc.json b/.jsdoc.json index 55facd41..94fc1aa0 100644 --- a/.jsdoc.json +++ b/.jsdoc.json @@ -1,6 +1,5 @@ { "opts": { - "readme": "docs/plugins.md", "template": "node_modules/minami" }, "source": { diff --git a/script/publish-docs b/script/publish-docs index 94238bb7..32fa152e 100755 --- a/script/publish-docs +++ b/script/publish-docs @@ -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