#!/bin/sh set -e # Store the versions VERSION=$(node -e "process.stdout.write(require('./package.json').version)") HEAD=$(git rev-parse HEAD) # Generate docs npm run doc # Checkout the website into the tmp directory [ -d tmp/website ] || { REPO=https://github.com/probot/probot.github.io # If GH_TOKEN environment variable is present, use that to push. if [[ -n "$GH_TOKEN" ]]; then REPO=${REPO/https:\/\//https://${GH_TOKEN}@} fi mkdir -p tmp git clone $REPO tmp/website } # Update the website checkout cd tmp/website git pull origin master # Delete previously generated docs for this version rm -rf api/$VERSION # Copy over the new docs mv ../../out api/$VERSION # Update the /api/latest link to point to this version ln -sfn $VERSION api/latest # Update the submodule git submodule update --init cd _submodules/probot git fetch git checkout $HEAD cd ../.. # Commit and publish git add . git commit -m "Update docs for v$VERSION" git tag -f v$VERSION git push --tags origin master