publish-site 675 B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/env bash
  2. set -ex
  3. echo "About to publish $GITHUB_REF to gh-pages..."
  4. rm -rf ../gh-pages
  5. npm run docs:build
  6. git config --global user.name "$GIT_USER_NAME"
  7. git config --global user.email "$GIT_USER_EMAIL"
  8. git clone -b gh-pages --single-branch https://"${GH_TOKEN_PUBLIC}"@github.com/ajv-validator/ajv.git ../gh-pages
  9. rsync -a ./docs/.vuepress/dist/ ../gh-pages
  10. cd ../gh-pages
  11. if [[ $(git status --porcelain) ]]; then
  12. echo "Changes detected. Updating gh-pages branch..."
  13. git add -A
  14. git commit -m "updated by ajv workflow https://github.com/ajv-validator/ajv/actions/runs/$GITHUB_RUN_ID"
  15. git push --quiet origin gh-pages > /dev/null 2>&1
  16. fi
  17. echo "Done"