Generate pre-rendered docs and update docs/
#1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and deploy docs | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build (CSS + Docs) | |
| run: npm run build | |
| - name: Copy generated docs into repository `docs/` folder | |
| run: | | |
| echo "Copying generated docs into docs/ directory" | |
| ls -la docs/site/generated || (echo 'generated docs not found' && exit 1) | |
| mkdir -p docs/_site_tmp | |
| cp -r docs/site/generated/* docs/_site_tmp/ | |
| # Copy into docs/ root (this will overwrite files at docs/ that match generated output) | |
| cp -r docs/_site_tmp/* docs/ | |
| - name: Commit and push generated docs to repository | |
| env: | |
| GIT_AUTHOR_NAME: github-actions[bot] | |
| GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | |
| run: | | |
| git config user.name "$GIT_AUTHOR_NAME" | |
| git config user.email "$GIT_AUTHOR_EMAIL" | |
| git add docs | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "chore(docs): update generated docs [ci skip]" | |
| git push origin HEAD:master | |
| fi |