Skip to content

Commit

Permalink
[增加]1. 增加镜像同步
Browse files Browse the repository at this point in the history
  • Loading branch information
AlianBlank committed Jan 19, 2025
1 parent cd89bb1 commit 3c54c2b
Showing 1 changed file with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,95 @@ jobs:
git pull --progress -v --no-rebase framagit ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
git push -u framagit ${{ github.ref_name }} --tags --verbose
fi

sync-codeup-admin:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # 为了 git pull --unshallow,我们需要获取所有的提交历史

- name: Set up Git user
run: |
git config --global user.email "[email protected]"
git config --global user.name "AlianBlank"
- name: Set SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.CODEUP_ID_RSA }}" >> ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
eval $(ssh-agent -s) && ssh-add ~/.ssh/id_rsa
# 信任域名
ssh-keyscan -H codeup.aliyun.com >> ~/.ssh/known_hosts
# 查看当前分支
- name: Check current branch
run: echo 当前分支:${{ github.ref_name }} ${{ github.Repository }}
# 查看远端 地址
- name: echo git url
run: echo codeup.aliyun.com:652bee7ea3bbd14127c037dd/GameFrameX/Admin/${{ github.Repository }}.git

# 添加远端
- name: add remote url
run: git remote add codeup "[email protected]:652bee7ea3bbd14127c037dd/GameFrameX/Admin/${{ github.Repository }}.git"

# 获取
- name: fetch
run: git fetch --prune codeup --tags --verbose

# 拉取
- name: pull and push
run: |
if [ "${{ github.ref_name }}" ]; then
git checkout ${{ github.ref_name }}
git pull --progress -v --no-rebase codeup ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
git push -u codeup ${{ github.ref_name }} --tags --verbose
fi
sync-codeup-hope:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # 为了 git pull --unshallow,我们需要获取所有的提交历史

- name: Set up Git user
run: |
git config --global user.email "[email protected]"
git config --global user.name "AlianBlank"
- name: Set SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.CODEUP_ID_RSA }}" >> ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
eval $(ssh-agent -s) && ssh-add ~/.ssh/id_rsa
# 信任域名
ssh-keyscan -H codeup.aliyun.com >> ~/.ssh/known_hosts
# 查看当前分支
- name: Check current branch
run: echo 当前分支:${{ github.ref_name }} ${{ github.Repository }}
# 查看远端 地址
- name: echo git url
run: echo [email protected]:652bee7ea3bbd14127c037dd/GameFrameX/Admin.Hope/${{ github.Repository }}.git

# 添加远端
- name: add remote url
run: git remote add codeup "[email protected]:652bee7ea3bbd14127c037dd/GameFrameX/Admin.Hope/${{ github.Repository }}.git"

# 获取
- name: fetch
run: git fetch --prune codeup --tags --verbose

# 拉取
- name: pull and push
run: |
if [ "${{ github.ref_name }}" ]; then
git checkout ${{ github.ref_name }}
git pull --progress -v --no-rebase codeup ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
git push -u codeup ${{ github.ref_name }} --tags --verbose
fi

0 comments on commit 3c54c2b

Please sign in to comment.