deploy_book.yaml 895 B

123456789101112131415161718192021222324252627282930313233
  1. name: Deploy
  2. on:
  3. push:
  4. branches:
  5. - master
  6. jobs:
  7. deploy:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - uses: actions/checkout@v2
  11. with:
  12. fetch-depth: 0
  13. - name: Install mdbook
  14. run: |
  15. mkdir mdbook
  16. curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.14/mdbook-v0.4.14-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
  17. echo `pwd`/mdbook >> $GITHUB_PATH
  18. - name: Deploy GitHub Pages
  19. run: |
  20. cd book
  21. mdbook build
  22. git worktree add gh-pages gh-pages
  23. git config user.name "Deploy from CI"
  24. git config user.email ""
  25. cd gh-pages
  26. # Delete the ref to avoid keeping history.
  27. git update-ref -d refs/heads/gh-pages
  28. rm -rf *
  29. mv ../book/* .
  30. git add .
  31. git commit -m "Deploy $GITHUB_SHA to gh-pages"
  32. git push --force