Skip to content

Commit 1c87d54

Browse files
committed
[增加]1. 增加新的同步渠道
1 parent bac09b9 commit 1c87d54

File tree

1 file changed

+100
-8
lines changed

1 file changed

+100
-8
lines changed

.github/workflows/sync.yml

Lines changed: 100 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Sync Github To Image
22

33
on:
44
push:
5-
branches: [main]
6-
#schedule:
5+
branches: [ main ]
6+
#schedule:
77
# 定时任务,每天 UTC 时间 0 点运行
88
#- cron: "0 0 * * *"
99
#workflow_dispatch:
@@ -50,7 +50,7 @@ jobs:
5050

5151
# 拉取
5252
- name: pull and push
53-
run: |
53+
run: |
5454
if [ "${{ github.ref_name }}" ]; then
5555
git checkout ${{ github.ref_name }}
5656
git pull --progress -v --no-rebase gitlink ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
@@ -96,7 +96,7 @@ jobs:
9696

9797
# 拉取
9898
- name: pull and push
99-
run: |
99+
run: |
100100
if [ "${{ github.ref_name }}" ]; then
101101
git checkout ${{ github.ref_name }}
102102
git pull --progress -v --no-rebase gitlab ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
@@ -142,7 +142,7 @@ jobs:
142142

143143
# 拉取
144144
- name: pull and push
145-
run: |
145+
run: |
146146
if [ "${{ github.ref_name }}" ]; then
147147
git checkout ${{ github.ref_name }}
148148
git pull --progress -v --no-rebase gitee ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
@@ -188,7 +188,7 @@ jobs:
188188

189189
# 拉取
190190
- name: pull and push
191-
run: |
191+
run: |
192192
if [ "${{ github.ref_name }}" ]; then
193193
git checkout ${{ github.ref_name }}
194194
git pull --progress -v --no-rebase atomgit ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
@@ -234,7 +234,7 @@ jobs:
234234

235235
# 拉取
236236
- name: pull and push
237-
run: |
237+
run: |
238238
if [ "${{ github.ref_name }}" ]; then
239239
git checkout ${{ github.ref_name }}
240240
git pull --progress -v --no-rebase gitcode ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
@@ -280,9 +280,101 @@ jobs:
280280

281281
# 拉取
282282
- name: pull and push
283-
run: |
283+
run: |
284284
if [ "${{ github.ref_name }}" ]; then
285285
git checkout ${{ github.ref_name }}
286286
git pull --progress -v --no-rebase framagit ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
287287
git push -u framagit ${{ github.ref_name }} --tags --verbose
288288
fi
289+
290+
291+
sync-codeup-admin:
292+
runs-on: ubuntu-latest
293+
294+
steps:
295+
- name: Checkout code
296+
uses: actions/checkout@v4
297+
with:
298+
fetch-depth: 0 # 为了 git pull --unshallow,我们需要获取所有的提交历史
299+
300+
- name: Set up Git user
301+
run: |
302+
git config --global user.email "[email protected]"
303+
git config --global user.name "AlianBlank"
304+
305+
- name: Set SSH
306+
run: |
307+
mkdir -p ~/.ssh
308+
echo "${{ secrets.CODEUP_ID_RSA }}" >> ~/.ssh/id_rsa
309+
chmod 600 ~/.ssh/id_rsa
310+
eval $(ssh-agent -s) && ssh-add ~/.ssh/id_rsa
311+
# 信任域名
312+
ssh-keyscan -H codeup.aliyun.com >> ~/.ssh/known_hosts
313+
# 查看当前分支
314+
- name: Check current branch
315+
run: echo 当前分支:${{ github.ref_name }} ${{ github.Repository }}
316+
# 查看远端 地址
317+
- name: echo git url
318+
run: echo codeup.aliyun.com:652bee7ea3bbd14127c037dd/GameFrameX/Admin/GameFrameX.Admin.git
319+
320+
# 添加远端
321+
- name: add remote url
322+
run: git remote add codeup "[email protected]:652bee7ea3bbd14127c037dd/GameFrameX/Admin/GameFrameX.Admin.git"
323+
324+
# 获取
325+
- name: fetch
326+
run: git fetch --prune codeup --tags --verbose
327+
328+
# 拉取
329+
- name: pull and push
330+
run: |
331+
if [ "${{ github.ref_name }}" ]; then
332+
git checkout ${{ github.ref_name }}
333+
git pull --progress -v --no-rebase codeup ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
334+
git push -u codeup ${{ github.ref_name }} --tags --verbose
335+
fi
336+
sync-codeup-hope:
337+
runs-on: ubuntu-latest
338+
339+
steps:
340+
- name: Checkout code
341+
uses: actions/checkout@v4
342+
with:
343+
fetch-depth: 0 # 为了 git pull --unshallow,我们需要获取所有的提交历史
344+
345+
- name: Set up Git user
346+
run: |
347+
git config --global user.email "[email protected]"
348+
git config --global user.name "AlianBlank"
349+
350+
- name: Set SSH
351+
run: |
352+
mkdir -p ~/.ssh
353+
echo "${{ secrets.CODEUP_ID_RSA }}" >> ~/.ssh/id_rsa
354+
chmod 600 ~/.ssh/id_rsa
355+
eval $(ssh-agent -s) && ssh-add ~/.ssh/id_rsa
356+
# 信任域名
357+
ssh-keyscan -H codeup.aliyun.com >> ~/.ssh/known_hosts
358+
# 查看当前分支
359+
- name: Check current branch
360+
run: echo 当前分支:${{ github.ref_name }} ${{ github.Repository }}
361+
# 查看远端 地址
362+
- name: echo git url
363+
run: echo [email protected]:652bee7ea3bbd14127c037dd/GameFrameX/Admin.Hope/GameFrameX.Admin.git
364+
365+
# 添加远端
366+
- name: add remote url
367+
run: git remote add codeup "[email protected]:652bee7ea3bbd14127c037dd/GameFrameX/Admin.Hope/GameFrameX.Admin.git"
368+
369+
# 获取
370+
- name: fetch
371+
run: git fetch --prune codeup --tags --verbose
372+
373+
# 拉取
374+
- name: pull and push
375+
run: |
376+
if [ "${{ github.ref_name }}" ]; then
377+
git checkout ${{ github.ref_name }}
378+
git pull --progress -v --no-rebase codeup ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
379+
git push -u codeup ${{ github.ref_name }} --tags --verbose
380+
fi

0 commit comments

Comments
 (0)