deploy-github-pages.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # 将静态内容部署到 GitHub Pages 的简易工作流程
  2. name: Deploy Github Pages
  3. on:
  4. # 仅在推送到默认分支时运行。
  5. push:
  6. branches: [ 'master' ]
  7. # 这个选项可以使你手动在 Action tab 页面触发工作流
  8. workflow_dispatch:
  9. # 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages。
  10. permissions:
  11. contents: write
  12. pages: write
  13. id-token: write
  14. jobs:
  15. # 单次部署的工作描述
  16. deploy:
  17. environment:
  18. name: github-pages
  19. url: ${{ steps.deployment.outputs.page_url }}
  20. runs-on: ubuntu-latest
  21. steps:
  22. - name: Checkout
  23. uses: actions/checkout@v3
  24. - name: Install pnpm
  25. uses: pnpm/action-setup@v2
  26. with:
  27. version: 8
  28. - name: Set up Node
  29. uses: actions/setup-node@v3
  30. with:
  31. node-version: 18
  32. cache: 'pnpm'
  33. - name: Install dependencies
  34. run: pnpm install
  35. - name: Build
  36. run: pnpm run build-gp-pages
  37. - name: Setup Pages
  38. uses: actions/configure-pages@v3
  39. - name: Upload artifact
  40. uses: actions/upload-pages-artifact@v1
  41. with:
  42. # Upload dist repository
  43. path: './dist'
  44. - name: Deploy to GitHub Pages
  45. id: deployment
  46. uses: actions/deploy-pages@v1