forked from mineadmin/MineAdmin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a gitee repository synchronisation process (mineadmin#174)
* Added Sync gitee actions --------- Co-authored-by: Death-Satan <[email protected]>
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Sync Gitee Repository | ||
|
||
on: | ||
schedule: | ||
- cron: '* 1 * * *' | ||
|
||
jobs: | ||
sync: | ||
runs-on: ubuntu-latest | ||
env: | ||
SSH_PRIVATE_KEY: ${{ secrets.SSH_KEY }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup 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/mineadmin/mineadmin.git' | ||
DESTINATION_REPO: '[email protected]:mineadmin/mineadmin.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 |