doc: web communication #362
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: Build the book | |
on: | |
push: | |
branches: | |
- docs | |
concurrency: building | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: docs | |
fetch-depth: 0 # all history for building | |
- uses: actions/setup-node@v2-beta | |
with: | |
node-version: '16' | |
- name: Configure | |
run: | | |
git version | |
git clone --depth=1 --branch=build https://github.com/aleen42/PersonalWiki.git temp | |
mv -f temp/* ./ | |
mv temp/.bookignore ./ | |
git clone --depth=1 --branch=gh-pages https://github.com/aleen42/PersonalWiki.git gh-pages | |
- name: Dependencies | |
id: cache-npm | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- if: ${{ steps.cache-npm.outputs.cache-hit == 'false' }} | |
name: List dependencies | |
continue-on-error: true | |
run: npm list | |
- name: Build | |
run: | | |
npm version | |
npm install --no-save --no-audit | |
npm run gitbook:install | |
npm run gitbook:build | |
node ./config.js | |
env: | |
ACCESS_TOKEN: ${{secrets.ACCESS_TOKEN}} | |
- name: Deploy | |
uses: JamesIves/[email protected] | |
with: | |
single-commit: true | |
branch: gh-pages | |
folder: gh-pages |