book.yml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. name: Generate DarkFi Book
  2. on:
  3. push:
  4. branches:
  5. - master
  6. - mdbook-stuff
  7. jobs:
  8. compile-book:
  9. runs-on: ubuntu-latest
  10. steps:
  11. - uses: actions/checkout@v2
  12. with:
  13. persist-credentials: false
  14. fetch-depth: 0
  15. - name: Install Python
  16. uses: actions/setup-python@v1
  17. with:
  18. python-version: 3.9
  19. - name: Install Rust
  20. uses: actions-rs/toolchain@v1
  21. with:
  22. toolchain: stable
  23. override: true
  24. components: rustfmt, clippy
  25. - uses: Swatinem/rust-cache@v1
  26. - name: Install ghp-import and mdbook
  27. run: |
  28. pip install ghp-import
  29. sudo apt -y install make wget
  30. wget "https://github.com/badboy/mdbook-toc/releases/download/0.10.0/mdbook-toc-0.10.0-x86_64-unknown-linux-gnu.tar.gz"
  31. wget "https://github.com/lzanini/mdbook-katex/releases/download/v0.2.18/mdbook-katex-v0.2.18-x86_64-unknown-linux-gnu.tar.gz"
  32. wget "https://github.com/badboy/mdbook-mermaid/releases/download/v0.12.3/mdbook-mermaid-v0.12.3-x86_64-unknown-linux-gnu.tar.gz"
  33. wget "https://github.com/rust-lang/mdBook/releases/download/v0.4.22/mdbook-v0.4.22-x86_64-unknown-linux-gnu.tar.gz"
  34. for i in *.tar.gz; do
  35. tar xf "$i"
  36. rm -f "$i"
  37. done
  38. mv -v mdbook* /usr/local/bin/
  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