vitepress-deploy.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. name: Docs Auto Deploy
  2. on:
  3. push:
  4. branches:
  5. - main
  6. paths:
  7. - 'config/**.json'
  8. - 'docs/**'
  9. - 'package.json'
  10. - 'yarn.lock'
  11. - '.github/workflows/vitepress-deploy.yml'
  12. jobs:
  13. build:
  14. name: Deploy docs
  15. runs-on: ubuntu-latest
  16. if: github.repository == 'crazywhalecc/static-php-cli'
  17. steps:
  18. - name: Checkout master
  19. uses: actions/checkout@v4
  20. - uses: actions/setup-node@v3
  21. with:
  22. node-version: 18
  23. cache: yarn
  24. - run: yarn install --frozen-lockfile
  25. - name: "Copy Config Files"
  26. run: |
  27. mkdir -p docs/.vitepress/config
  28. cp -r config/* docs/.vitepress/config/
  29. - name: "Install PHP for official runners"
  30. uses: "shivammathur/setup-php@v2"
  31. with:
  32. coverage: none
  33. tools: composer:v2
  34. php-version: 8.2
  35. ini-values: memory_limit=-1
  36. - name: "Get Composer Cache Directory"
  37. id: composer-cache
  38. run: |
  39. echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
  40. - name: "Cache Composer dependencies"
  41. uses: "actions/cache@v4"
  42. with:
  43. path: "${{ steps.composer-cache.outputs.dir }}"
  44. key: "php-8.2-locked-composer-${{ hashFiles('**/composer.lock') }}"
  45. restore-keys: |
  46. php-8.2-locked-composer
  47. - name: "Install Locked Dependencies"
  48. run: "composer install --no-interaction --no-progress"
  49. - name: "Generate Extension Support List"
  50. run: |
  51. bin/spc dev:gen-ext-docs > docs/extensions.md
  52. bin/spc dev:gen-ext-dep-docs > docs/deps-map-ext.md
  53. bin/spc dev:gen-lib-dep-docs > docs/deps-map-lib.md
  54. - name: Build
  55. run: yarn docs:build
  56. - name: Deploy to GitHub Pages
  57. uses: peaceiris/actions-gh-pages@v3
  58. with:
  59. github_token: ${{ secrets.GITHUB_TOKEN }}
  60. publish_dir: docs/.vitepress/dist