-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a65a05a
commit b971342
Showing
1 changed file
with
55 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,56 @@ | ||
name: Mirror to Gitee Repo | ||
|
||
# on: [ push, delete, create ] | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
git-mirror: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Configure Private Key | ||
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 | ||
env: | ||
# SOURCE_REPO: 'https://github.com/mgithubTestOrg/giteeMirror.git' | ||
SOURCE_REPO: 'https://github.com/${{ github.repository }}.git' | ||
# DESTINATION_REPO: '[email protected]:mgithubTestOrg/giteeMirror.git' | ||
# DESTINATION_REPO: '[email protected]:${{ github.repository }}.git' | ||
DESTINATION_REPO: '[email protected]:websoft9op/${{ github.event.repository.name }}.git' | ||
BASE_REPO: 'https://github.com/${{ github.repository }}' | ||
run: | | ||
git clone "$SOURCE_REPO" && cd `basename "$BASE_REPO"` | ||
git config --global user.name "${{ github.actor }}" | ||
git config --global user.email "[email protected]" | ||
git remote set-url --push origin "$DESTINATION_REPO" | ||
git push origin main --force | ||
git checkout dev | ||
if [ -f "requirements.yml" ];then | ||
sed -i 's/github/gitee/g' requirements.yml | ||
git add requirements.yml | ||
git commit -m "Make requirements.yml compatible with gitee" | ||
fi | ||
git push origin dev --force | ||
git checkout main | ||
git fetch -p origin | ||
git for-each-ref --format 'delete %(refname)' refs/pull | git update-ref --stdin | ||
git push origin main --force | ||
if [ -f "requirements.yml" ];then | ||
sed -i 's/github/gitee/g' requirements.yml | ||
git add requirements.yml | ||
git commit -m "Make requirements.yml compatible with gitee" | ||
fi | ||
name: Mirror to Gitee Repo | ||
|
||
# on: [ push, delete, create ] | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
git-mirror: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Configure Private Key | ||
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 | ||
env: | ||
# SOURCE_REPO: 'https://github.com/mgithubTestOrg/giteeMirror.git' | ||
SOURCE_REPO: 'https://github.com/${{ github.repository }}.git' | ||
# DESTINATION_REPO: '[email protected]:mgithubTestOrg/giteeMirror.git' | ||
# DESTINATION_REPO: '[email protected]:${{ github.repository }}.git' | ||
DESTINATION_REPO: '[email protected]:websoft9/${{ github.event.repository.name }}.git' | ||
BASE_REPO: 'https://github.com/${{ github.repository }}' | ||
run: | | ||
git clone "$SOURCE_REPO" && cd `basename "$BASE_REPO"` | ||
git config --global user.name "${{ github.actor }}" | ||
git config --global user.email "[email protected]" | ||
git remote set-url --push origin "$DESTINATION_REPO" | ||
git push origin main --force | ||
git checkout dev | ||
if [ -f "requirements.yml" ];then | ||
sed -i 's/github/gitee/g' requirements.yml | ||
git add requirements.yml | ||
git commit -m "Make requirements.yml compatible with gitee" | ||
fi | ||
git push origin dev --force | ||
git checkout main | ||
git fetch -p origin | ||
git for-each-ref --format 'delete %(refname)' refs/pull | git update-ref --stdin | ||
git push origin main --force | ||
if [ -f "requirements.yml" ];then | ||
sed -i 's/github/gitee/g' requirements.yml | ||
git add requirements.yml | ||
git commit -m "Make requirements.yml compatible with gitee" | ||
fi | ||
git push origin main --force |