简化镜像仓库同步 workflow (#5004)

This commit is contained in:
Glavo
2025-12-19 16:02:02 +08:00
committed by GitHub
parent dc7c883962
commit 9ec494664c
4 changed files with 32 additions and 39 deletions

29
.github/workflows/mirror.yml vendored Normal file
View File

@@ -0,0 +1,29 @@
name: Mirror Repository
on:
workflow_dispatch:
workflow_call:
push:
jobs:
mirror:
strategy:
matrix:
target:
- name: Gitee
repo: gitee.com/huanghongxun/HMCL
user: 'GITEE_SYNC_USERNAME'
token: 'GITEE_SYNC_TOKEN'
- name: CNB
repo: cnb.cool/HMCL-dev/HMCL
user: 'CNB_SYNC_USERNAME'
token: 'CNB_SYNC_TOKEN'
name: Mirror to ${{ matrix.target.name }}
if: ${{ github.repository == 'HMCL-dev/HMCL' }}
runs-on: ubuntu-latest
steps:
- name: Mirror GitHub to ${{ matrix.target.name }}
run: |
git clone --mirror "https://github.com/$GITHUB_REPOSITORY.git" -- repo
cd repo
git push -f --prune "https://${{ secrets[matrix.target.user] }}:${{ secrets[matrix.target.token] }}@${{ matrix.target.repo }}.git" "refs/heads/*:refs/heads/*" "refs/tags/*:refs/tags/*"