:::danger 弃用:繁琐
新思路:走CDN回源 :::

一、思路

  • 仓库一:wztlink1013.github.io【master】
  • 仓库二:test【gh-pages】

将test仓库下gh-pages分支下的所有文件复制到文件夹test,在wztlink1013.github.io仓库下clone到文件夹wztlink1013.github.io中,进入wztlink1013.github.io文件夹,然后通过命令将test文件夹复制到wztlink1013文件夹中,最后push到wztlink1013.github.io仓库中。

二、编写脚本

  1. git config --global user.name 'wztlink1013'
  2. git config --global user.email 'wztlink1013@163.com'
  3. git clone https://github.com/wztlink1013/test.git
  4. git clone https://github.com/wztlink1013/wztlink1013.github.io.git
  1. cd wztlink1013.github.io
  2. mkdir test
  3. cd ..
  4. xcopy .\test .\wztlink1013.github.io /e
  1. cd wztlink1013.github.io
  2. git status
  3. git add .
  4. git commit -m "add gh-pages files"
  5. git push "https://${Github_Token}@github.com/wztlink1013/wztlink1013.github.io" master:master

三、编写GitHub Actions

  1. name: CI for wztlink1013.github.io
  2. on: [push, watch]
  3. jobs:
  4. build:
  5. runs-on: ubuntu-latest
  6. steps:
  7. - uses: actions/checkout@v2
  8. - name: 配置Git
  9. run: |
  10. git config --global user.name 'wztlink1013'
  11. git config --global user.email 'wztlink1013@163.com'
  12. - name: 在云端进行复制文件夹操作
  13. env:
  14. Github_Token: ${{ secrets.TOKEN_GITHUBAPI }}
  15. run: |
  16. git clone https://github.com/wztlink1013/visualization visualization
  17. git clone https://github.com/wztlink1013/wztlink1013.github.io .github_pages
  18. cd visualization
  19. rm -r .git
  20. rm -r .github
  21. cd ..
  22. cd .github_pages
  23. rm -r visualization
  24. cd ..
  25. mv visualization/ -f .github_pages/
  26. cd .github_pages
  27. git status
  28. git add .
  29. git commit -m "add gh-pages files"
  30. git push --force --quiet "https://${Github_Token}@github.com/wztlink1013/wztlink1013.github.io" master:master