mkdocs.yaml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Simple workflow for deploying static content to GitHub Pages
  2. name: Deploy SmartDNS Pages
  3. on:
  4. # Runs on pushes targeting the default branch
  5. push:
  6. branches: ["doc"]
  7. # Allows you to run this workflow manually from the Actions tab
  8. workflow_dispatch:
  9. # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
  10. permissions:
  11. contents: read
  12. pages: write
  13. id-token: write
  14. # Allow one concurrent deployment
  15. concurrency:
  16. group: "pages"
  17. cancel-in-progress: true
  18. jobs:
  19. # Single deploy job since we're just deploying
  20. deploy:
  21. environment:
  22. name: github-pages
  23. url: ${{ steps.deployment.outputs.page_url }}
  24. runs-on: ubuntu-latest
  25. steps:
  26. - name: Checkout
  27. uses: actions/checkout@v4
  28. - name: Run the build process with Docker
  29. uses: addnab/docker-run-action@v3
  30. with:
  31. image: squidfunk/mkdocs-material:latest
  32. options: -v ${{ github.workspace }}:/root
  33. run: |
  34. cd /root/en
  35. mkdocs build
  36. cd /root
  37. SITE_URL=${{ vars.SITE_URL }} mkdocs build
  38. mv /root/en/site /root/site/en
  39. # patch 404 page, remove absolute path
  40. [ -z "${{ vars.SITE_URL }}" ] && sed 's@="/@="@g' -i /root/site/404.html
  41. sed 's@="/@="@g' -i /root/site/en/404.html
  42. # patch language change url
  43. find /root/site -name "*.htm*" -print0 | xargs -0 sed -i 's/href=" .."/href=".."/g'
  44. find /root/site -name "*.htm*" -print0 | xargs -0 sed -i 's@/ .."@/.."@g'
  45. - name: Setup Pages
  46. uses: actions/configure-pages@v5
  47. - name: Upload artifact
  48. uses: actions/upload-pages-artifact@v3
  49. with:
  50. # Upload entire repository
  51. path: 'site'
  52. - name: Deploy to GitHub Pages
  53. id: deployment
  54. uses: actions/deploy-pages@v4