gh-pages.yml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. name: syncToGitee
  2. env:
  3. # 7 GiB by default on GitHub, setting to 6 GiB
  4. # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
  5. NODE_OPTIONS: --max-old-space-size=6144
  6. on:
  7. push:
  8. branches: [main]
  9. jobs:
  10. repo-sync:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - uses: actions/checkout@v2
  14. # 设置服务器时区为东八区
  15. - name: Set time zone
  16. run: sudo timedatectl set-timezone 'Asia/Shanghai'
  17. - name: Setup Node.js v14.x
  18. uses: actions/setup-node@v1
  19. with:
  20. node-version: '14.x'
  21. - name: Get yarn cache directory path
  22. id: yarn-cache-dir-path
  23. run: echo "::set-output name=dir::$(yarn cache dir)"
  24. - uses: actions/cache@v3
  25. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  26. with:
  27. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  28. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  29. restore-keys: |
  30. ${{ runner.os }}-yarn-
  31. - name: Install
  32. run: yarn install --frozen-lockfile
  33. - uses: actions/cache@v3
  34. with:
  35. # 缓存文件夹
  36. path: node_modules/.cache/webpack/
  37. key: ${{ github.ref.name }}-webpack-build
  38. # 兜底使用 "main" 分支缓存
  39. restore-keys: |
  40. main-webpack-build
  41. - name: Build
  42. run: yarn build
  43. - name: Deploy
  44. uses: peaceiris/actions-gh-pages@v3
  45. with:
  46. publish_dir: ./dist
  47. personal_token: ${{ secrets.PERSONAL_TOKEN }}
  48. commit_message: Update ghPages
  49. force_orphan: true
  50. - name: Mirror the Github organization repos to Gitee.
  51. uses: Yikun/hub-mirror-action@master
  52. with:
  53. src: 'github/buqiyuan'
  54. dst: 'gitee/buqiyuan'
  55. dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
  56. dst_token: ${{ secrets.GITEE_TOKEN }}
  57. static_list: 'vue3-antd-admin'
  58. force_update: true
  59. debug: true
  60. - name: Build Gitee Pages
  61. uses: yanglbme/gitee-pages-action@main
  62. with:
  63. # 注意替换为你的 Gitee 用户名
  64. gitee-username: buqiyuan
  65. # 注意在 Settings->Secrets 配置 GITEE_PASSWORD
  66. gitee-password: ${{ secrets.GITEE_PASSWORD }}
  67. # 注意替换为你的 Gitee 仓库,仓库名严格区分大小写,请准确填写,否则会出错
  68. gitee-repo: buqiyuan/vue3-antd-admin
  69. # 是否强制使用 HTTPS
  70. https: true
  71. # 要部署的分支,默认是 master,若是其他分支,则需要指定(指定的分支必须存在)
  72. branch: gh-pages