docs.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. name: docs
  2. on:
  3. # trigger deployment on every push to main branch
  4. workflow_dispatch:
  5. jobs:
  6. docs:
  7. runs-on: ubuntu-latest
  8. steps:
  9. - uses: actions/checkout@v3
  10. with:
  11. # fetch all commits to get last updated time or other git log info
  12. fetch-depth: 0
  13. - name: Setup Node.js
  14. uses: actions/setup-node@v3
  15. with:
  16. # choose node.js version to use
  17. node-version: "14"
  18. - uses: pnpm/action-setup@v2.0.1
  19. name: Install pnpm --no-frozen-lockfile
  20. id: pnpm-install
  21. with:
  22. version: 7
  23. run_install: false
  24. # - name: Get pnpm store directory
  25. # id: pnpm-cache
  26. # working-directory: "docs"
  27. # run: |
  28. # echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
  29. # - uses: actions/cache@v3
  30. # name: Setup pnpm cache
  31. # with:
  32. # path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
  33. # key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
  34. # restore-keys: |
  35. # ${{ runner.os }}-pnpm-store-
  36. - name: Install dependencies
  37. working-directory: "docs"
  38. run: pnpm install --no-frozen-lockfile
  39. # run build script
  40. - name: Build VuePress site
  41. working-directory: "docs"
  42. run: pnpm run build
  43. # please check out the docs of the workflow for more details
  44. # @see https://github.com/crazy-max/ghaction-github-pages
  45. - name: Deploy to GitHub Pages
  46. uses: crazy-max/ghaction-github-pages@v2
  47. with:
  48. # deploy to gh-pages branch
  49. target_branch: gh-pages
  50. # deploy the default output dir of VuePress
  51. build_dir: docs/src/.vuepress/dist
  52. env:
  53. # @see https://docs.github.com/en/actions/reference/authentication-in-a-workflow#about-the-github_token-secret
  54. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}