This article is originally published by Yanglbme.

When using GitHub Pages, GitHub automatically redeploys GitHub Pages for us whenever there is an update to the project. For domestic Gitee Pages, it is generally unable to be automatically deployed unless we open the Gitee Pages Pro function. The opening of Pro function needs to meet one of the following conditions:

  • Spend money to openProFunction, ¥99/ year.
  • Gitee project is good enough to be recommended by Gitee official, then Gitee will prompt “Your project is recommended project, it has been automatically opened for youGitee Pages Pro“.

In order to help more friends to implement automatic deployment of Gitee Pages, I developed the Gitee Pages Action. Just configure keys in the project Settings page and create a workflow under.github/workflows/. Just introduce some configuration parameters.

The ginseng

parameter describe Whether will pass The default value
gitee-username Gitee user name is
gitee-password Gitee password is
gitee-repo Gitee warehouse is
branch Built branch no master
directory Built directory no ‘ ‘
https Whether to force HTTPS no true

The sample

Here is a complete example.

Create a sync.yml file in your GitHub repository. GitHub /workflows/ folder with the following contents:

name: Sync

on:
  push:
    branches: [ master ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Sync to Gitee
      uses: wearerequired/git-mirror-action@master
      env:
          # Notice that GITEE_RSA_PRIVATE_KEY is configured in Settings->Secrets
          SSH_PRIVATE_KEY: The ${{ secrets.GITEE_RSA_PRIVATE_KEY }}
      with:
          Replace this with your GitHub source repository address
          source-repo: "[email protected]:doocs/advanced-java.git"
          Replace this with your Gitee target warehouse address
          destination-repo: "[email protected]:Doocs/advanced-java.git"

    - name: Build Gitee Pages
      uses: yanglbme/gitee-pages-action@master
      with:
          Replace this with your Gitee username
          gitee-username: yanglbme
          # Notice in Settings->Secrets configure GITEE_PASSWORD
          gitee-password: The ${{ secrets.GITEE_PASSWORD }}
          # Note your Gitee repository instead
          gitee-repo: doocs/advanced-java
Copy the code

First, use Wearerequired /git-mirror-action to synchronize GitHub repository to Gitee repository, and then use Yanglbme/Gite-pages-action to realize automatic deployment of Gitee Pages.

Make sure GITEE_RSA_PRIVATE_KEY and GITEE_PASSWORD are configured in the GitHub project Settings -> Secrets path. Among them:

  • GITEE_RSA_PRIVATE_KEY: Store yoursid_rsaThe private key.
  • GITEE_PASSWORD: Store your Gitee account password.

If everything is configured correctly and the Gitee Pages Action is successfully triggered, we may receive an alarm email/in-site letter from Gitee. Rest assured, GitHub Action logged us into the Gitee website and clicked the deploy button for us.

license

MIT