From 9facb513b26bc1618b6395b90dbd3c2cf8e8ab17 Mon Sep 17 00:00:00 2001 From: Ke Sun Date: Thu, 2 Apr 2026 11:33:09 +0800 Subject: [PATCH 1/3] ci: refactor Gitee sync workflow with selective branch filtering - Remove hidden workflow file (.sync-to-gitee.yml) and replace with standard naming - Update trigger configuration to sync only main, develop, release/*, and hotfix/* branches - Add tag synchronization for all version tags - Improve branch push logic to explicitly reference origin branches - Simplify workflow by removing unnecessary comments and consolidating sync logic --- .github/workflows/.sync-to-gitee.yml | 35 --------------------------- .github/workflows/sync-to-gitee.yml | 36 ++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 35 deletions(-) delete mode 100644 .github/workflows/.sync-to-gitee.yml create mode 100644 .github/workflows/sync-to-gitee.yml diff --git a/.github/workflows/.sync-to-gitee.yml b/.github/workflows/.sync-to-gitee.yml deleted file mode 100644 index b8b39c90..00000000 --- a/.github/workflows/.sync-to-gitee.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Sync All Branches to Gitee - -on: - push: - branches: - - '*' - -jobs: - sync: - runs-on: ubuntu-latest - - steps: - - name: Checkout Source Code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Sync All Branches - run: | - # 1. 配置 Git 用户信息 - git config --global user.name "GitHub Actions" - git config --global user.email "actions@github.com" - - # 2. 构建带 Token 的 HTTPS 远程地址 - GITEE_URL="https://${{ secrets.GITEE_USERNAME }}:${{ secrets.GITEE_TOKEN }}@gitee.com/${{ secrets.GITEE_USERNAME }}/MemoryBear.git" - - # 3. 添加远程仓库 (命名为 gitee) - git remote add gitee $GITEE_URL - - # 4. 遍历并推送所有分支 - # 这一步会获取本地所有分支名,并依次推送到 Gitee - for branch in $(git branch -r | grep -v HEAD | sed 's/origin\///'); do - echo "Syncing branch: $branch" - git push -f gitee $branch:$branch - done \ No newline at end of file diff --git a/.github/workflows/sync-to-gitee.yml b/.github/workflows/sync-to-gitee.yml new file mode 100644 index 00000000..b262ed67 --- /dev/null +++ b/.github/workflows/sync-to-gitee.yml @@ -0,0 +1,36 @@ +name: Sync to Gitee + +on: + push: + branches: + - main # Production + - develop # Integration + - 'release/*' # Release preparation + - 'hotfix/*' # Urgent fixes + tags: + - '*' # All version tags (v1.0.0, etc.) + +jobs: + sync: + runs-on: ubuntu-latest + + steps: + - name: Checkout Source Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Sync to Gitee + run: | + GITEE_URL="https://${{ secrets.GITEE_USERNAME }}:${{ secrets.GITEE_TOKEN }}@gitee.com/${{ secrets.GITEE_USERNAME }}/MemoryBear.git" + git remote add gitee "$GITEE_URL" + + # 遍历并推送所有分支 + for branch in $(git branch -r | grep -v HEAD | sed 's/origin\///'); do + echo "Syncing branch: $branch" + git push -f gitee "origin/$branch:refs/heads/$branch" + done + + # 推送所有标签 + echo "Syncing tags..." + git push gitee --tags --force From 2c7aaebdd5188ef7395e7be5d7d95d03506fa2de Mon Sep 17 00:00:00 2001 From: Ke Sun Date: Thu, 2 Apr 2026 11:50:15 +0800 Subject: [PATCH 2/3] ci(gitee): update Gitee repository path in sync workflow - Replace dynamic username variable with static repository path - Update Gitee remote URL to use correct organization namespace - Ensure sync workflow targets the correct Gitee repository --- .github/workflows/sync-to-gitee.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-to-gitee.yml b/.github/workflows/sync-to-gitee.yml index b262ed67..71ddf22a 100644 --- a/.github/workflows/sync-to-gitee.yml +++ b/.github/workflows/sync-to-gitee.yml @@ -22,7 +22,7 @@ jobs: - name: Sync to Gitee run: | - GITEE_URL="https://${{ secrets.GITEE_USERNAME }}:${{ secrets.GITEE_TOKEN }}@gitee.com/${{ secrets.GITEE_USERNAME }}/MemoryBear.git" + GITEE_URL="https://${{ secrets.GITEE_USERNAME }}:${{ secrets.GITEE_TOKEN }}@gitee.com/hangzhou-hongxiong-intelligent_1/MemoryBear.git" git remote add gitee "$GITEE_URL" # 遍历并推送所有分支 From 9f2cd6afae330a18af6052a6a0e16be4d134d6e0 Mon Sep 17 00:00:00 2001 From: Ke Sun Date: Thu, 2 Apr 2026 11:57:23 +0800 Subject: [PATCH 3/3] docs: add status badges to README files - Add Apache 2.0 license badge to both README.md and README_CN.md - Add Python 3.12+ version badge with logo - Add Gitee Sync workflow status badge linking to GitHub Actions - Improve project visibility with standardized badge indicators --- README.md | 4 ++++ README_CN.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/README.md b/README.md index 95d8d737..cd5be68b 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ # MemoryBear empowers AI with human-like memory capabilities +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) +[![Python](https://img.shields.io/badge/Python-3.12+-green?logo=python&logoColor=white)](https://www.python.org/) +[![Gitee Sync](https://img.shields.io/github/actions/workflow/status/SuanmoSuanyangTechnology/MemoryBear/sync-to-gitee.yml?label=Gitee%20Sync&logo=gitee&logoColor=white)](https://github.com/SuanmoSuanyangTechnology/MemoryBear/actions/workflows/sync-to-gitee.yml) + [中文](./README_CN.md) | English ### [Installation Guide](#memorybear-installation-guide) diff --git a/README_CN.md b/README_CN.md index 1472acac..31ea718f 100644 --- a/README_CN.md +++ b/README_CN.md @@ -2,6 +2,10 @@ # MemoryBear 让AI拥有如同人类一样的记忆 +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) +[![Python](https://img.shields.io/badge/Python-3.12+-green?logo=python&logoColor=white)](https://www.python.org/) +[![Gitee Sync](https://img.shields.io/github/actions/workflow/status/SuanmoSuanyangTechnology/MemoryBear/sync-to-gitee.yml?label=Gitee%20Sync&logo=gitee&logoColor=white)](https://github.com/SuanmoSuanyangTechnology/MemoryBear/actions/workflows/sync-to-gitee.yml) + 中文 | [English](./README.md) ### [安装教程](#memorybear安装教程)