2021-03-08 11:56:43 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
echo "-- Generating documentation."
|
|
|
|
echo "-- Node version: $(node -v)"
|
|
|
|
echo "-- NPM version: $(npm -v)"
|
|
|
|
|
|
|
|
git fetch origin
|
|
|
|
git checkout ${CHECKOUT_REF/refs\/heads\//}
|
|
|
|
|
|
|
|
cd docs
|
|
|
|
npm install
|
|
|
|
npm run build
|
|
|
|
|
|
|
|
echo "-- Documentation successfully generated."
|
|
|
|
|
|
|
|
if git diff --quiet; then
|
|
|
|
echo "-- No documentation changes to commit."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
REMOTE_URL="$(git config remote.origin.url)"
|
|
|
|
TARGET_REPO=${REMOTE_URL/https:\/\/github.com\//github.com/}
|
|
|
|
GITHUB_REPO=https://${GH_TOKEN:-git}@${TARGET_REPO}
|
|
|
|
|
2021-04-27 00:35:19 +00:00
|
|
|
git config user.name "Github Actions"
|
2021-03-08 11:56:43 +00:00
|
|
|
git config user.email "$COMMIT_AUTHOR_EMAIL"
|
|
|
|
|
|
|
|
git add ./generated
|
|
|
|
git pull
|
2021-04-27 00:35:19 +00:00
|
|
|
git commit -m "docs(ci): Update generated docs - $(git rev-parse --short HEAD) [skip ci]"
|
|
|
|
git push -q $GITHUB_REPO
|