Skip to content

Commit a50baf3

Browse files
committed
ci: replace hub-mirror-action with direct git push for Gitee sync
1 parent 0c5e3b5 commit a50baf3

2 files changed

Lines changed: 33 additions & 19 deletions

File tree

.github/workflows/build-docker-image.yml

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,25 @@ jobs:
3333
- uses: actions/checkout@v6
3434
with:
3535
fetch-depth: 0
36-
- uses: Yikun/hub-mirror-action@master
37-
with:
38-
src: github/whyour
39-
dst: gitee/whyour
40-
dst_key: ${{ secrets.GITLAB_SSH_PK }}
41-
dst_token: ${{ secrets.GITEE_TOKEN }}
42-
static_list: "qinglong"
43-
force_update: true
36+
- name: Setup SSH and push to Gitee
37+
env:
38+
GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }}
39+
run: |
40+
mkdir -p ~/.ssh
41+
echo "${{ secrets.GITLAB_SSH_PK }}" > ~/.ssh/id_rsa
42+
chmod 600 ~/.ssh/id_rsa
43+
ssh-keyscan gitee.com >> ~/.ssh/known_hosts
44+
git remote add gitee git@gitee.com:whyour/qinglong.git 2>/dev/null || true
45+
git push --force --all gitee || {
46+
echo "Repo may not exist, creating via API..."
47+
curl -sS --connect-timeout 30 --max-time 60 \
48+
-X POST "https://gitee.com/api/v5/user/repos" \
49+
-H "Content-Type: application/json" \
50+
-d '{"name":"qinglong","private":"false"}' \
51+
"?access_token=$GITEE_TOKEN" || true
52+
git push --force --all gitee
53+
}
54+
git push --force --tags gitee
4455
4556
build-static:
4657
runs-on: ubuntu-latest
@@ -98,17 +109,18 @@ jobs:
98109
needs: build-static
99110
runs-on: ubuntu-latest
100111
steps:
101-
- uses: actions/checkout@v6
102-
with:
103-
fetch-depth: 0
104-
- uses: Yikun/hub-mirror-action@master
105-
with:
106-
src: github/whyour
107-
dst: gitee/whyour
108-
dst_key: ${{ secrets.GITLAB_SSH_PK }}
109-
dst_token: ${{ secrets.GITEE_TOKEN }}
110-
static_list: "qinglong-static"
111-
force_update: true
112+
- name: Setup SSH
113+
run: |
114+
mkdir -p ~/.ssh
115+
echo "${{ secrets.GITLAB_SSH_PK }}" > ~/.ssh/id_rsa
116+
chmod 600 ~/.ssh/id_rsa
117+
ssh-keyscan github.com gitee.com >> ~/.ssh/known_hosts
118+
- name: Mirror qinglong-static to Gitee
119+
run: |
120+
git clone --mirror https://github.com/whyour/qinglong-static.git static-mirror
121+
cd static-mirror
122+
git remote set-url origin git@gitee.com:whyour/qinglong-static.git
123+
git push --force --mirror
112124
113125
build:
114126
if: ${{ !startsWith(github.ref, 'refs/tags/') }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ __pycache__
2828
/shell/preload/notify.*
2929
/shell/preload/*-notify.json
3030
/shell/preload/__ql_notify__.*
31+
32+
.deepseek/

0 commit comments

Comments
 (0)