auto-merge.yml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. name: Automerge
  2. on:
  3. pull_request:
  4. types:
  5. - labeled
  6. - unlabeled
  7. - synchronize
  8. - opened
  9. - edited
  10. - ready_for_review
  11. - reopened
  12. - unlocked
  13. pull_request_review:
  14. types:
  15. - submitted
  16. status: {}
  17. jobs:
  18. # 合并发布版本的 pr 到 master
  19. auto-merge:
  20. runs-on: ubuntu-latest
  21. steps:
  22. - name: Automerge
  23. uses: 'pascalgn/automerge-action@v0.14.3'
  24. env:
  25. GITHUB_TOKEN: '${{ secrets.TOKEN }}'
  26. MERGE_LABELS: ''
  27. MERGE_FILTER_AUTHOR: 'kailong321200875'
  28. push-to-gh-pages:
  29. needs: [auto-merge]
  30. runs-on: ubuntu-latest
  31. steps:
  32. - name: Checkout
  33. uses: actions/checkout@v2
  34. - name: Setup Pnpm
  35. uses: pnpm/action-setup@v2
  36. with:
  37. version: latest
  38. - name: use Node.js 16
  39. uses: actions/setup-node@v2.1.2
  40. with:
  41. node-version: '16.x'
  42. - name: Cache ~/.pnpm-store
  43. uses: actions/cache@v3
  44. env:
  45. cache-name: cache-pnpm-store
  46. with:
  47. path: ~/.pnpm-store
  48. key: ${{ runner.os }}-${{ matrix.node-version }}-test-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
  49. restore-keys: |
  50. ${{ runner.os }}-${{ matrix.node-version }}-test-${{ env.cache-name }}-
  51. ${{ runner.os }}-${{ matrix.node-version }}-test-
  52. ${{ runner.os }}-
  53. - name: Set SSH Environment
  54. env:
  55. DOCS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
  56. run: |
  57. mkdir -p ~/.ssh/
  58. echo "$ACTIONS_DEPLOY_KEY" > ~/.ssh/id_rsa
  59. chmod 600 ~/.ssh/id_rsa
  60. ssh-keyscan github.com > ~/.ssh/known_hosts
  61. chmod 700 ~/.ssh && chmod 600 ~/.ssh/*
  62. git config --local user.email "321200875@qq.com"
  63. git config --local user.name "kailong321200875"
  64. # 发布到 github
  65. - name: Build Github
  66. run: |
  67. pnpm install --no-frozen-lockfile
  68. pnpm run build:pro
  69. - name: Deploy Github
  70. uses: peaceiris/actions-gh-pages@v3
  71. with:
  72. deploy_key: ${{secrets.ACTIONS_DEPLOY_KEY}}
  73. publish_branch: gh-pages
  74. publish_dir: ./dist-pro
  75. force_orphan: true
  76. cname: element-plus-admin.cn
  77. push-to-gh-pages-gitee:
  78. needs: [auto-merge]
  79. runs-on: ubuntu-latest
  80. steps:
  81. - name: Checkout
  82. uses: actions/checkout@v2
  83. - name: Setup Pnpm
  84. uses: pnpm/action-setup@v2
  85. with:
  86. version: latest
  87. - name: use Node.js 16
  88. uses: actions/setup-node@v2.1.2
  89. with:
  90. node-version: '16.x'
  91. - name: Cache ~/.pnpm-store
  92. uses: actions/cache@v3
  93. env:
  94. cache-name: cache-pnpm-store
  95. with:
  96. path: ~/.pnpm-store
  97. key: ${{ runner.os }}-${{ matrix.node-version }}-test-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
  98. restore-keys: |
  99. ${{ runner.os }}-${{ matrix.node-version }}-test-${{ env.cache-name }}-
  100. ${{ runner.os }}-${{ matrix.node-version }}-test-
  101. ${{ runner.os }}-
  102. - name: Set SSH Environment
  103. env:
  104. DOCS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
  105. run: |
  106. mkdir -p ~/.ssh/
  107. echo "$ACTIONS_DEPLOY_KEY" > ~/.ssh/id_rsa
  108. chmod 600 ~/.ssh/id_rsa
  109. ssh-keyscan github.com > ~/.ssh/known_hosts
  110. chmod 700 ~/.ssh && chmod 600 ~/.ssh/*
  111. git config --local user.email "321200875@qq.com"
  112. git config --local user.name "kailong321200875"
  113. - name: Build Gitee
  114. run: |
  115. pnpm install --no-frozen-lockfile
  116. pnpm run build:gitee
  117. # 发布到 gitee
  118. - name: Deploy Gitee
  119. uses: peaceiris/actions-gh-pages@v3
  120. with:
  121. deploy_key: ${{secrets.ACTIONS_DEPLOY_KEY}}
  122. publish_branch: gh-pages-gitee
  123. publish_dir: ./dist-pro
  124. force_orphan: true
  125. - name: Sync Github Repos To Gitee # 名字随便起
  126. uses: Yikun/hub-mirror-action@v1.1 # 使用Yikun/hub-mirror-action
  127. with:
  128. src: github/kailong321200875 # 源端账户名(github)
  129. dst: gitee/kailong110120130 # 目的端账户名(gitee)
  130. dst_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} # SSH密钥对中的私钥
  131. dst_token: ${{ secrets.GITEE_TOKEN }} # Gitee账户的私人令牌
  132. account_type: user # 账户类型
  133. clone_style: 'https' # 使用https方式进行clone,也可以使用ssh
  134. debug: true # 启用后会显示所有执行命令
  135. force_update: true # 启用后,强制同步,即强制覆盖目的端仓库
  136. static_list: 'vue-element-plus-admin' # 静态同步列表,在此填写需要同步的仓库名称,可填写多个
  137. timeout: '600s' # git超时设置,超时后会自动重试git操作