diff --git a/.github/workflows/buildbook&deploy.yaml b/.github/workflows/buildbook&deploy.yaml new file mode 100644 index 00000000..6cb54850 --- /dev/null +++ b/.github/workflows/buildbook&deploy.yaml @@ -0,0 +1,50 @@ +name: build-book +on: [push] +jobs: + build: + runs-on: [ubuntu-latest] + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: 12.x + - uses: actions/cache@v1 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/book.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: setup env to build website + run: | + npm install gitbook-cli -g + gitbook install + - name: setup env to generate file + if: startsWith(github.ref, 'refs/tags/') + run: | + export TZ='Asia/Shanghai' + sudo apt-get install calibre fonts-noto-cjk -y + - name: build website + run: | + gitbook build . ./build + rm -rf ./build/.github + echo "" > ./build/.nojekyll + - name: generate file + if: startsWith(github.ref, 'refs/tags/') + run: | + mkdir book + xvfb-run gitbook pdf ./ ./book/book.pdf + gitbook epub ./ ./book/book.epub + gitbook mobi ./ ./book/book.mobi + + - name: deploy to pages + uses: peaceiris/actions-gh-pages@v2 + env: + PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }} + PUBLISH_BRANCH: gh-pages + PUBLISH_DIR: ./build + - name: send to release + uses: fnkr/github-action-ghr@v1 + if: startsWith(github.ref, 'refs/tags/') + env: + GHR_PATH: ./book + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index 34fb7456..942ccf7f 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,5 @@ [**電子書線上看**](https://cypherpunks-core.github.io/ethereumbook_zh/)、[**電子書下載**](https://github.com/cypherpunks-core/ethereumbook_zh/releases)、[**本倉庫位置**](https://github.com/cypherpunks-core/ethereumbook_zh) # Mastering Ethereum - 繁中 -![](https://img.shields.io/badge/Language-Traditional%20Chinese-orange.svg) -[![](https://img.shields.io/badge/Author-aantonop-yellowgreen.svg)](https://github.com/aantonop) -[![](https://img.shields.io/badge/Translator-inoutcode-lightgrey.svg)](https://github.com/inoutcode)[![](https://travis-ci.org/cypherpunks-core/ethereumbook_zh.svg?branch=master)](https://travis-ci.org/cypherpunks-core/ethereumbook_zh) -