book.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. export PATH="$HOME/bin:$PATH"
  39. - name: Compile and publish the book
  40. run: |
  41. git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
  42. git config --local user.name "parazyd"
  43. cd doc
  44. make github
  45. git checkout gh-pages
  46. - name: Push changes
  47. uses: ad-m/github-push-action@master
  48. with:
  49. github_token: ${{ secrets.GITHUB_TOKEN }}
  50. branch: gh-pages