Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature mirror to gitee #919

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/mirror-to-gitee.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: mirror-to-gitee

on: [ push, pull_request ]

jobs:
mirror-to-gitee:
if: ${{ (github.repository_owner == 'swoole') && (github.repository == 'swoole/swoole-cli') }}
runs-on: ubuntu-latest
steps:
- name: install deps
run: |
sudo apt install openssh-client git

- name: Prepare Secret Key
env:
MIRROR_TO_GITEE_SECRET_KEY: ${{ secrets.MIRROR_TO_GITEE_SECRET_KEY }}
run: |
mkdir -p ~/.ssh/
printf "%s\n" "$MIRROR_TO_GITEE_SECRET_KEY" > ~/.ssh/push-to-gitee-key
chmod 0400 ~/.ssh/push-to-gitee-key
cat > ~/.ssh/config <<'EOF'
Host gitee.com
Hostname gitee.com
Port 22
PreferredAuthentications publickey
StrictHostKeyChecking no
IdentityFile ~/.ssh/push-to-gitee-key
EOF
ls -lh ~/.ssh/

- name: mirror to gitee with git mirror
run: |
set -x

git clone --mirror https://github.com/swoole/swoole-cli.git swoole-cli
cd swoole-cli
git remote -v

git remote set-url --push origin git@gitee.com:swoole/swoole-cli.git
git remote -v

git fetch -p origin
git for-each-ref --format 'delete %(refname)' refs/pull | git update-ref --stdin

git push --mirror
Loading