Skip to content

Commit 3c54c2b

Browse files
committed
[增加]1. 增加镜像同步
1 parent cd89bb1 commit 3c54c2b

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

.github/workflows/sync.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,3 +286,95 @@ jobs:
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/${{ github.Repository }}.git
319+
320+
# 添加远端
321+
- name: add remote url
322+
run: git remote add codeup "[email protected]:652bee7ea3bbd14127c037dd/GameFrameX/Admin/${{ github.Repository }}.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/${{ github.Repository }}.git
364+
365+
# 添加远端
366+
- name: add remote url
367+
run: git remote add codeup "[email protected]:652bee7ea3bbd14127c037dd/GameFrameX/Admin.Hope/${{ github.Repository }}.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)