@@ -33,14 +33,38 @@ 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+ set +e
41+ mkdir -p ~/.ssh
42+ printf '%s\n' "${{ secrets.GITLAB_SSH_PK }}" > ~/.ssh/id_rsa
43+ chmod 600 ~/.ssh/id_rsa
44+ ssh-keyscan -T 10 gitee.com >> ~/.ssh/known_hosts 2>/dev/null
45+ git remote add gitee git@gitee.com:whyour/qinglong.git 2>/dev/null
46+
47+ if git push --force --all gitee 2>&1; then
48+ echo "::notice::Gitee push --all succeeded"
49+ else
50+ echo "::warning::Push --all failed, trying to create repo via API..."
51+ curl -sS --connect-timeout 30 --max-time 60 \
52+ -X POST "https://gitee.com/api/v5/user/repos" \
53+ -H "Content-Type: application/json" \
54+ -d '{"name":"qinglong","private":"false"}' \
55+ "?access_token=$GITEE_TOKEN" 2>/dev/null
56+ if git push --force --all gitee 2>&1; then
57+ echo "::notice::Gitee push --all succeeded after repo creation"
58+ else
59+ echo "::warning::Gitee push --all failed after retry"
60+ fi
61+ fi
62+
63+ if git push --force --tags gitee 2>&1; then
64+ echo "::notice::Gitee push --tags succeeded"
65+ else
66+ echo "::warning::Gitee push --tags failed"
67+ fi
4468
4569 build-static :
4670 runs-on : ubuntu-latest
@@ -98,17 +122,18 @@ jobs:
98122 needs : build-static
99123 runs-on : ubuntu-latest
100124 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
125+ - name : Setup SSH
126+ run : |
127+ mkdir -p ~/.ssh
128+ echo "${{ secrets.GITLAB_SSH_PK }}" > ~/.ssh/id_rsa
129+ chmod 600 ~/.ssh/id_rsa
130+ ssh-keyscan github.com gitee.com >> ~/.ssh/known_hosts
131+ - name : Mirror qinglong-static to Gitee
132+ run : |
133+ git clone --mirror https://github.com/whyour/qinglong-static.git static-mirror
134+ cd static-mirror
135+ git remote set-url origin git@gitee.com:whyour/qinglong-static.git
136+ git push --force --mirror
112137
113138 build :
114139 if : ${{ !startsWith(github.ref, 'refs/tags/') }}
0 commit comments