book.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. name: Generate DarkFi Book
  2. on:
  3. push:
  4. branches:
  5. - master
  6. jobs:
  7. compile-book:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - uses: actions/checkout@v2
  11. with:
  12. persist-credentials: false
  13. fetch-depth: 0
  14. - name: Install Python
  15. uses: actions/setup-python@v1
  16. with:
  17. python-version: 3.9
  18. - name: Install Rust
  19. uses: actions-rs/toolchain@v1
  20. with:
  21. toolchain: stable
  22. override: true
  23. components: rustfmt, clippy
  24. - uses: Swatinem/rust-cache@v1
  25. - name: Install ghp-import and mdbook
  26. run: |
  27. pip install ghp-import
  28. sudo apt -y install make wget
  29. wget "https://github.com/badboy/mdbook-toc/releases/download/0.10.0/mdbook-toc-0.10.0-x86_64-unknown-linux-gnu.tar.gz"
  30. wget "https://github.com/lzanini/mdbook-katex/releases/download/v0.2.18/mdbook-katex-v0.2.18-x86_64-unknown-linux-gnu.tar.gz"
  31. wget "https://github.com/badboy/mdbook-mermaid/releases/download/v0.12.3/mdbook-mermaid-v0.12.3-x86_64-unknown-linux-gnu.tar.gz"
  32. wget "https://github.com/rust-lang/mdBook/releases/download/v0.4.22/mdbook-v0.4.22-x86_64-unknown-linux-gnu.tar.gz"
  33. for i in *.tar.gz; do
  34. tar xf "$i"
  35. rm -f "$i"
  36. done
  37. mkdir -p "$HOME/bin"
  38. mv -v mdbook* "$HOME/bin"
  39. export PATH="$HOME/bin:$PATH"
  40. - name: Compile and publish the book
  41. run: |
  42. git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
  43. git config --local user.name "parazyd"
  44. cd doc
  45. make github
  46. git checkout gh-pages
  47. - name: Push changes
  48. uses: ad-m/github-push-action@master
  49. with:
  50. github_token: ${{ secrets.GITHUB_TOKEN }}
  51. branch: gh-pages