简介
GitHub 的自动化流水线,主要功能为
- 监听推送分支
- 自动构建并部署支 GitHub Pages
- 自动推送至 Gitee
- 将构建完成的内容也推送至 Gitee Pages
./.github/workflow/pages.yml
只要创建了这个文件再去项目顶部标签的 Actions 配置即可
简单加点备注,留存个笔记
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
| name: Pages
on: push: branches: - master
jobs: pages: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Use Node.js 12.x uses: actions/setup-node@v1 with: node-version: '12.x' - name: Cache NPM dependencies uses: actions/cache@v2 with: path: node_modules key: ${{ runner.OS }}-npm-cache restore-keys: | ${{ runner.OS }}-npm-cache - name: Install Dependencies run: npm install - name: Show ls run: ls - name: Install plugin run: cp -rf plugins/hexo-filter-sequence/* node_modules/hexo-filter-sequence/ - name: Build run: npm run build - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public publish_branch: source
sync: needs: pages runs-on: ubuntu-latest steps: - name: Sync to Gitee uses: wearerequired/git-mirror-action@master env: SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }} with: source-repo: "git@github.com:zhyib/zhyib.github.io.git" destination-repo: "git@gitee.com:zhyib/zhyib.git" gitee-pages: needs: sync runs-on: ubuntu-latest steps: - name: Build Gitee Pages uses: yanglbme/gitee-pages-action@master with: gitee-username: zhyib gitee-password: ${{ secrets.GITEE_PASSWORD }} gitee-repo: zhyib/zhyib
|
说明
公私钥
- 在本机上生成 ssh 密钥
ssh-keygen
- 给 Github项目设置配置私钥
id_rsa
因为是ssh链接发起方
- 在 Gitee 的个人设置页面「安全设置 -> SSH 公钥」 配置 SSH 公钥,因为是链接的接收方
GitHub
最终有两个配置
欢迎来我的博客
zhyib.gitee.io
zhyib.github.io