Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Github Actions to Automatically Sync Code Pushed to Github to Gitee #134

Open
LiZhenCheng9527 opened this issue Feb 27, 2024 · 2 comments

Comments

@LiZhenCheng9527
Copy link
Collaborator

What would you like to be added:
Use Github Actions to Automatically Sync Code Pushed to Github to Gitee.
Why is this needed:
In addition to having a code repository on GitHub, the Kmesh project also has a code repository on Gitee. But the code repository on Gitee lags far behind and has a lot more missing code. And the newly released was also not synced to the Gitee repository. Therefore, we hope there is a GitHub action that can automatically push the new version code to Gitee when releasing a version.

@hzxuzhonghu
Copy link
Member

Is there a tool that we can use?

@LiZhenCheng9527
Copy link
Collaborator Author

We can use jenkey2011/vuepress-deploy and wearerequired/git-mirror-action to help us automatically push code to gitee. We need to add public keys in both GitHub and Gitee, generate corresponding tokens and relevant credentials. Then use GitHub Actions to automatically synchronize the code.

name: Build and Deploy
on: [push]
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@master

    - name: vuepress-deploy
      uses: jenkey2011/vuepress-deploy@master
      env:
        ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
        TARGET_REPO: username/repo
        TARGET_BRANCH: master
        BUILD_SCRIPT: yarn && yarn build
        BUILD_DIR: blog/.vuepress/dist/
        CNAME: https://www.dachangxiaoyuan.top
  sync:
    needs: build-and-deploy
    runs-on: ubuntu-latest
    steps:
    - name: Sync to Gitee
      uses: wearerequired/git-mirror-action@master
      env:
        SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }}
      with:
        source-repo: "git@github.com:source.repo.git"
        destination-repo: "git@gitee.com:target.repo.git"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants