website.yml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. name: website
  2. on:
  3. push:
  4. branches: [ main ]
  5. pull_request:
  6. branches: [ main ]
  7. workflow_dispatch:
  8. permissions:
  9. contents: read
  10. concurrency:
  11. group: website-${{ github.ref }}
  12. cancel-in-progress: true
  13. jobs:
  14. deploy:
  15. runs-on: ubuntu-latest
  16. steps:
  17. - uses: actions/checkout@v4
  18. ###################################################
  19. - uses: actions/setup-node@v4
  20. - name: Retype build
  21. run: |
  22. python scripts/gen_docs.py
  23. cd docs
  24. npm install retypeapp -g
  25. retype build
  26. ###################################################
  27. - name: Setup emsdk
  28. uses: mymindstorm/setup-emsdk@v14
  29. with:
  30. version: latest
  31. actions-cache-folder: 'emsdk-cache-v2'
  32. - name: Compile
  33. run: |
  34. bash build_web.sh
  35. mkdir -p docs/.retype/static
  36. mv web docs/.retype/static
  37. touch docs/.retype/.nojekyll
  38. ###################################################
  39. - name: Deploy to pocketpy.github.io
  40. uses: crazy-max/ghaction-github-pages@v3
  41. with:
  42. repo: pocketpy/pocketpy.github.io
  43. target_branch: main
  44. keep_history: true
  45. build_dir: docs/.retype
  46. jekyll: false
  47. env:
  48. # PAT with Contents: write permission on pocketpy/pocketpy.github.io.
  49. GH_PAT: ${{ secrets.WEBSITE_DEPLOY_TOKEN }}
  50. if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'pocketpy/pocketpy'