gitee-sync #38
This file contains hidden or 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
| name: gitee-sync | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| sync: | |
| name: gitee-sync | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| if: github.actor != 'dependabot[bot]' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Configure SSH key for Gitee | |
| uses: webfactory/ssh-agent@v0.9.0 | |
| with: | |
| ssh-private-key: ${{ secrets.GITEE_PI_SSH }} | |
| - name: Verify Gitee SSH connectivity | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p ~/.ssh | |
| ssh-keyscan -H gitee.com >> ~/.ssh/known_hosts | |
| ssh -o BatchMode=yes -T git@gitee.com || true | |
| git ls-remote git@gitee.com:agoraio-community/API-Examples.git HEAD | |
| - name: Mirror repo to Gitee | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| rm -rf /tmp/API-Examples.git | |
| git clone --mirror https://github.com/Shengwang-Community/API-Examples.git /tmp/API-Examples.git | |
| cd /tmp/API-Examples.git | |
| git remote add gitee git@gitee.com:agoraio-community/API-Examples.git | |
| git push --mirror gitee |