|
63 | 63 | git push -u --force gitlink ${{ github.ref_name }} --tags --verbose |
64 | 64 | fi |
65 | 65 |
|
66 | | - sync-gitlab: |
67 | | - runs-on: ubuntu-latest |
68 | | - |
69 | | - steps: |
70 | | - - name: Checkout code |
71 | | - uses: actions/checkout@v4 |
72 | | - with: |
73 | | - fetch-depth: 0 # 为了 git pull --unshallow,我们需要获取所有的提交历史 |
74 | | - |
75 | | - - name: Set up Git user |
76 | | - run: | |
77 | | - git config --global user.email "wangfj11@foxmail.com" |
78 | | - git config --global user.name "AlianBlank" |
79 | | -
|
80 | | - - name: Set SSH |
81 | | - run: | |
82 | | - mkdir -p ~/.ssh |
83 | | - echo "${{ secrets.GITLAB_ID_RSA }}" >> ~/.ssh/id_rsa |
84 | | - chmod 600 ~/.ssh/id_rsa |
85 | | - eval $(ssh-agent -s) && ssh-add ~/.ssh/id_rsa |
86 | | - # 信任域名 |
87 | | - ssh-keyscan -H gitlab.com >> ~/.ssh/known_hosts |
88 | | - # 查看当前分支 |
89 | | - - name: Check current branch |
90 | | - run: echo 当前分支:${{ github.ref_name }} ${{ github.Repository }} |
91 | | - # 查看远端 地址 |
92 | | - - name: echo git url |
93 | | - run: echo git@gitlab.com:${{ github.Repository }}.git |
94 | | - |
95 | | - # 添加远端 |
96 | | - - name: add remote url |
97 | | - run: git remote add gitlab "git@gitlab.com:${{ github.Repository }}.git" |
98 | | - |
99 | | - # 获取 |
100 | | - - name: fetch |
101 | | - run: git fetch --prune gitlab --tags --verbose |
102 | | - |
103 | | - # 拉取 |
104 | | - - name: pull |
105 | | - run: | |
106 | | - if [ "${{ github.ref_name }}" ]; then |
107 | | - git checkout ${{ github.ref_name }} |
108 | | - git pull --progress -v --no-rebase gitlab ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支; |
109 | | - fi |
110 | | -
|
111 | | - # 推送 |
112 | | - - name: push |
113 | | - run: | |
114 | | - if [ "${{ github.ref_name }}" ]; then |
115 | | - git push -u --force gitlab ${{ github.ref_name }} --tags --verbose |
116 | | - fi |
117 | | -
|
118 | 66 | sync-gitee: |
119 | 67 | runs-on: ubuntu-latest |
120 | 68 |
|
@@ -271,54 +219,3 @@ jobs: |
271 | 219 | # git push -u --force gitcode ${{ github.ref_name }} --tags --verbose |
272 | 220 | # fi |
273 | 221 |
|
274 | | - sync-framagit: |
275 | | - runs-on: ubuntu-latest |
276 | | - |
277 | | - steps: |
278 | | - - name: Checkout code |
279 | | - uses: actions/checkout@v4 |
280 | | - with: |
281 | | - fetch-depth: 0 # 为了 git pull --unshallow,我们需要获取所有的提交历史 |
282 | | - |
283 | | - - name: Set up Git user |
284 | | - run: | |
285 | | - git config --global user.email "wangfj11@foxmail.com" |
286 | | - git config --global user.name "AlianBlank" |
287 | | -
|
288 | | - - name: Set SSH |
289 | | - run: | |
290 | | - mkdir -p ~/.ssh |
291 | | - echo "${{ secrets.FRAMAGIT_ID_RSA }}" >> ~/.ssh/id_rsa |
292 | | - chmod 600 ~/.ssh/id_rsa |
293 | | - eval $(ssh-agent -s) && ssh-add ~/.ssh/id_rsa |
294 | | - # 信任域名 |
295 | | - ssh-keyscan -H framagit.org >> ~/.ssh/known_hosts |
296 | | - # 查看当前分支 |
297 | | - - name: Check current branch |
298 | | - run: echo 当前分支:${{ github.ref_name }} ${{ github.Repository }} |
299 | | - # 查看远端 地址 |
300 | | - - name: echo git url |
301 | | - run: echo git@framagit.org:${{ github.Repository }}.git |
302 | | - |
303 | | - # 添加远端 |
304 | | - - name: add remote url |
305 | | - run: git remote add framagit "git@framagit.org:${{ github.Repository }}.git" |
306 | | - |
307 | | - # 获取 |
308 | | - - name: fetch |
309 | | - run: git fetch --prune framagit --tags --verbose |
310 | | - |
311 | | - # 拉取 |
312 | | - - name: pull |
313 | | - run: | |
314 | | - if [ "${{ github.ref_name }}" ]; then |
315 | | - git checkout ${{ github.ref_name }} |
316 | | - git pull --progress -v --no-rebase framagit ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支; |
317 | | - fi |
318 | | -
|
319 | | - # 推送 |
320 | | - - name: push |
321 | | - run: | |
322 | | - if [ "${{ github.ref_name }}" ]; then |
323 | | - git push -u --force framagit ${{ github.ref_name }} --tags --verbose |
324 | | - fi |
0 commit comments