mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-02 03:37:44 +08:00
Mirror to Gitee Repo (#2819)
This commit is contained in:
parent
30162cbe30
commit
3ed2cef159
29
.github/workflows/gitee.yml
vendored
Normal file
29
.github/workflows/gitee.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
name: Mirror to Gitee Repo
|
||||
|
||||
on: [ push, delete, create ]
|
||||
|
||||
jobs:
|
||||
git-mirror:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Configure Private Key
|
||||
if: github.repository_owner == 'hyperf'
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.GITEE_PRIVATE_KEY }}
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
echo "StrictHostKeyChecking no" >> ~/.ssh/config
|
||||
|
||||
- name: Push Mirror
|
||||
if: github.repository_owner == 'hyperf'
|
||||
env:
|
||||
SOURCE_REPO: 'https://github.com/hyperf/hyperf.git'
|
||||
DESTINATION_REPO: 'git@gitee.com:hyperf/hyperf.git'
|
||||
run: |
|
||||
git clone --mirror "$SOURCE_REPO" && cd `basename "$SOURCE_REPO"`
|
||||
git remote set-url --push origin "$DESTINATION_REPO"
|
||||
git fetch -p origin
|
||||
git for-each-ref --format 'delete %(refname)' refs/pull | git update-ref --stdin
|
||||
git push --mirror
|
Loading…
Reference in New Issue
Block a user