Gitbook Build & Deploy to gh-pages #29
This file contains 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: Gitbook Build & Deploy to gh-pages | |
on: [workflow_dispatch] | |
permissions: | |
contents: write | |
jobs: | |
build-and-publish: | |
name: Build and Deploy Gitbook | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the source code from GitHub | |
uses: actions/checkout@v2 | |
with: { fetch-depth: 0 } | |
- name: Install Node.js (version 10, not higher!) | |
uses: actions/setup-node@v2 | |
with: { node-version: '10' } | |
- name: Install Gitbook CLI client (gitbook-cli) | |
run: npm install -g gitbook-cli | |
- name: Install Gitbook plugins (git install) | |
run: gitbook install | |
- name: Build the book to the `_book` folder (git build) | |
run: gitbook build . --log=debug --debug | |
- name: Checkout the `gh-pages` branch into the `_gh-pages` folder | |
run: git worktree add ./_gh-pages gh-pages | |
- name: Copy the compiled book files to `_gh-pages` | |
run: cp -R ./_book/* ./_gh-pages | |
- name: Commit and push the changed book files in the `gh-pages` branch | |
run: | | |
cd _gh-pages | |
git add . | |
git status | |
git config --local user.name "github-actions-gitbook-bot" | |
git config --local user.email "[email protected]" | |
git commit -m "Book web site deployment" | |
git push |