Skip to content

Commit 5140cb8

Browse files
committed
fix: 修复版本tag异常的工作流
1 parent 19be545 commit 5140cb8

File tree

1 file changed

+36
-30
lines changed

1 file changed

+36
-30
lines changed

.github/workflows/sync.yml

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
#- cron: "0 0 * * *"
1313
workflow_dispatch:
1414

15+
1516
jobs:
1617
sync-gitlink:
1718
runs-on: ubuntu-latest
@@ -46,21 +47,22 @@ jobs:
4647

4748
# 添加远端
4849
- name: add remote url
49-
run: git remote add gitlink "git@code.gitlink.org.cn:${{ github.Repository }}.git"
50+
run: git remote add mirror "git@code.gitlink.org.cn:${{ github.Repository }}.git"
5051

5152
# 获取
5253
- name: fetch
53-
run: git fetch --prune gitlink --tags --verbose
54+
run: git fetch --prune mirror --tags --verbose
5455

55-
# 拉取
56+
# 拉取和推送
5657
- name: pull and push
5758
run: |
5859
if [ "${{ github.ref_name }}" ]; then
5960
git checkout ${{ github.ref_name }}
60-
git pull --progress -v --no-rebase gitlink ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
61-
git push -u gitlink ${{ github.ref_name }} --tags --verbose
61+
git push -f mirror ${{ github.ref_name }}
62+
git push -f mirror --tags --verbose
6263
fi
6364
65+
6466
sync-gitlab:
6567
runs-on: ubuntu-latest
6668

@@ -92,21 +94,22 @@ jobs:
9294

9395
# 添加远端
9496
- name: add remote url
95-
run: git remote add gitlab "git@gitlab.com:${{ github.Repository }}.git"
97+
run: git remote add mirror "git@gitlab.com:${{ github.Repository }}.git"
9698

9799
# 获取
98100
- name: fetch
99-
run: git fetch --prune gitlab --tags --verbose
101+
run: git fetch --prune mirror --tags --verbose
100102

101-
# 拉取
103+
# 拉取和推送
102104
- name: pull and push
103105
run: |
104106
if [ "${{ github.ref_name }}" ]; then
105107
git checkout ${{ github.ref_name }}
106-
git pull --progress -v --no-rebase gitlab ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
107-
git push -u gitlab ${{ github.ref_name }} --tags --verbose
108+
git push -f mirror ${{ github.ref_name }}
109+
git push -f mirror --tags --verbose
108110
fi
109111
112+
110113
sync-gitee:
111114
runs-on: ubuntu-latest
112115

@@ -138,21 +141,22 @@ jobs:
138141

139142
# 添加远端
140143
- name: add remote url
141-
run: git remote add gitee "git@gitee.com:${{ github.Repository }}.git"
144+
run: git remote add mirror "git@gitee.com:${{ github.Repository }}.git"
142145

143146
# 获取
144147
- name: fetch
145-
run: git fetch --prune gitee --tags --verbose
148+
run: git fetch --prune mirror --tags --verbose
146149

147-
# 拉取
150+
# 拉取和推送
148151
- name: pull and push
149152
run: |
150153
if [ "${{ github.ref_name }}" ]; then
151154
git checkout ${{ github.ref_name }}
152-
git pull --progress -v --no-rebase gitee ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
153-
git push -u gitee ${{ github.ref_name }} --tags --verbose
155+
git push -f mirror ${{ github.ref_name }}
156+
git push -f mirror --tags --verbose
154157
fi
155158
159+
156160
sync-atomgit:
157161
runs-on: ubuntu-latest
158162

@@ -184,21 +188,22 @@ jobs:
184188

185189
# 添加远端
186190
- name: add remote url
187-
run: git remote add atomgit "git@atomgit.com:${{ github.Repository }}.git"
191+
run: git remote add mirror "git@atomgit.com:${{ github.Repository }}.git"
188192

189193
# 获取
190194
- name: fetch
191-
run: git fetch --prune atomgit --tags --verbose
195+
run: git fetch --prune mirror --tags --verbose
192196

193-
# 拉取
197+
# 拉取和推送
194198
- name: pull and push
195199
run: |
196200
if [ "${{ github.ref_name }}" ]; then
197201
git checkout ${{ github.ref_name }}
198-
git pull --progress -v --no-rebase atomgit ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
199-
git push -u atomgit ${{ github.ref_name }} --tags --verbose
202+
git push -f mirror ${{ github.ref_name }}
203+
git push -f mirror --tags --verbose
200204
fi
201205
206+
202207
sync-gitcode:
203208
runs-on: ubuntu-latest
204209

@@ -230,20 +235,21 @@ jobs:
230235

231236
# 添加远端
232237
- name: add remote url
233-
run: git remote add gitcode "git@gitcode.net:${{ github.Repository }}.git"
238+
run: git remote add mirror "git@gitcode.net:${{ github.Repository }}.git"
234239

235240
# 获取
236241
- name: fetch
237-
run: git fetch --prune gitcode --tags --verbose
242+
run: git fetch --prune mirror --tags --verbose
238243

239-
# 拉取
244+
# 拉取和推送
240245
- name: pull and push
241246
run: |
242247
if [ "${{ github.ref_name }}" ]; then
243248
git checkout ${{ github.ref_name }}
244-
git pull --progress -v --no-rebase gitcode ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
245-
git push -u gitcode ${{ github.ref_name }} --tags --verbose
249+
git push -f mirror ${{ github.ref_name }}
250+
git push -f mirror --tags --verbose
246251
fi
252+
247253
248254
sync-framagit:
249255
runs-on: ubuntu-latest
@@ -276,17 +282,17 @@ jobs:
276282

277283
# 添加远端
278284
- name: add remote url
279-
run: git remote add framagit "git@framagit.org:${{ github.Repository }}.git"
285+
run: git remote add mirror "git@framagit.org:${{ github.Repository }}.git"
280286

281287
# 获取
282288
- name: fetch
283-
run: git fetch --prune framagit --tags --verbose
289+
run: git fetch --prune mirror --tags --verbose
284290

285-
# 拉取
291+
# 拉取和推送
286292
- name: pull and push
287293
run: |
288294
if [ "${{ github.ref_name }}" ]; then
289295
git checkout ${{ github.ref_name }}
290-
git pull --progress -v --no-rebase framagit ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
291-
git push -u framagit ${{ github.ref_name }} --tags --verbose
296+
git push -f mirror ${{ github.ref_name }}
297+
git push -f mirror --tags --verbose
292298
fi

0 commit comments

Comments
 (0)