Merge branch 'dev' of github.com:qinshihu/itops-agent-platform into dev #80
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: Mirror to Gitee & Gitcode | |
| on: | |
| push: | |
| branches: [main, master, dev] | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| mirror: | |
| name: Mirror Code | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'qinshihu/itops-agent-platform' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Git | |
| run: | | |
| git config --global user.name "qinshihu" | |
| git config --global user.email "huawei_network@foxmail.com" | |
| - name: Push to Gitee | |
| env: | |
| GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }} | |
| run: | | |
| echo "Setting up Gitee remote..." | |
| git remote add gitee https://oauth2:${GITEE_TOKEN}@gitee.com/IT_Oline/itops-agent-platform.git || git remote set-url gitee https://oauth2:${GITEE_TOKEN}@gitee.com/IT_Oline/itops-agent-platform.git | |
| if [ "${{ github.ref_type }}" = "tag" ]; then | |
| echo "Pushing tags to Gitee..." | |
| git push gitee --tags --force --verbose 2>&1 | |
| else | |
| BRANCH="${{ github.ref_name }}" | |
| echo "Pushing branch: $BRANCH to Gitee..." | |
| git push gitee "$BRANCH" --force --verbose 2>&1 | |
| fi | |
| echo "Gitee sync completed!" | |
| - name: Push to Gitcode | |
| env: | |
| GITCODE_TOKEN: ${{ secrets.GITCODE_TOKEN }} | |
| run: | | |
| echo "Setting up Gitcode remote..." | |
| git remote add gitcode https://oauth2:${GITCODE_TOKEN}@gitcode.com/gcw_IM7aAihp/itops-agent-platform.git || git remote set-url gitcode https://oauth2:${GITCODE_TOKEN}@gitcode.com/gcw_IM7aAihp/itops-agent-platform.git | |
| if [ "${{ github.ref_type }}" = "tag" ]; then | |
| echo "Pushing tags to Gitcode..." | |
| git push gitcode --tags --force --verbose 2>&1 | |
| else | |
| BRANCH="${{ github.ref_name }}" | |
| echo "Pushing branch: $BRANCH to Gitcode..." | |
| git push gitcode "$BRANCH" --force --verbose 2>&1 | |
| fi | |
| echo "Gitcode sync completed!" |