hexo/node_modules/ajv/scripts/publish-site

26 lines
700 B
Plaintext
Raw Normal View History

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