| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | |
| 3 | set -ex |
| 4 | |
| 5 | echoscip-shell system . . echo. "About to publish $GITHUB_REF to gh-pages..." |
| 6 | rmscip-shell system . . rm. -rf ../gh-pages |
| 7 | |
| 8 | npmscip-shell system . . npm. install vuepress@1 |
| 9 | npmscip-shell system . . npm. install @vuepress/shared-utils@1 |
| 10 | npmscip-shell system . . npm. run docs:build |
| 11 | |
| 12 | gitscip-shell system . . git. config --global user.name "$GIT_USER_NAME" |
| 13 | gitscip-shell system . . git. config --global user.email "$GIT_USER_EMAIL" |
| 14 | gitscip-shell system . . git. clone -b gh-pages --single-branch https://"${GH_TOKEN_PUBLIC}"@github.com/ajv-validator/ajv.git ../gh-pages |
| 15 | |
| 16 | rsyncscip-shell system . . rsync. -a ./docs/.vuepress/dist/ ../gh-pages |
| 17 | |
| 18 | cd ../gh-pages |
| 19 | |
| 20 | if [[ $(git status --porcelain) ]]; then |
| 21 | echoscip-shell system . . echo. "Changes detected. Updating gh-pages branch..." |
| 22 | gitscip-shell system . . git. add -A |
| 23 | gitscip-shell system . . git. commit -m "updated by ajv workflow https://github.com/ajv-validator/ajv/actions/runs/$GITHUB_RUN_ID" |
| 24 | gitscip-shell system . . git. push --quiet origin gh-pages > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 25 | fi |
| 26 | |
| 27 | echoscip-shell system . . echo. "Done" |