instructions

Move native build process of vuepress blog to Github-Actions and support automatic deployment of build results to Gitee and automatic updating of Gitee Pages.

With this action you no longer need to worry about blog building, just write the document locally and push it to the repository. The rest of the build and deployment is done by Github Actions.

It saves local space and reduces operation steps.

Use dead simple actions

If you are using this tool for the first time, you can refer to the github Actions introduction as well as the Ruan Yifong github Actions Tutorial

Complete Actions code

This assumes that you already have a basic understanding of how to use Github Actions. If you are not sure how to use the following code, please refer to the above section on how to use Github Actions. The internal parameters of the code are described in detail below

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

    - name: Build and Deploy
      uses: jenkey2011/vuepress-deploy@master
      env:
        ACCESS_TOKEN: The ${{ secrets.ACCESS_TOKEN }}
        The target warehouse you want to operate on
        TARGET_REPO: linzowo/linzowo.github.io
        Build a branch of the result store
        TARGET_BRANCH: gh_pages
        # Build command to use
        BUILD_SCRIPT: yarn && yarn build
        Build the result store directory
        BUILD_DIR: docs/.vuepress/dist/
  sync:
    needs: build-and-deploy
    runs-on: ubuntu-latest
    steps:
    - name: Sync to Gitee
      uses: wearerequired/git-mirror-action@master
      env:
        SSH_PRIVATE_KEY: The ${{ secrets.GITEE_RSA_PRIVATE_KEY }}
      with:
      	# Source warehouse
        source-repo: "[email protected]:linzowo/linzowo.github.io.git"
        # Target warehouse
        destination-repo: "[email protected]:linzowo/linzowo.git"
  reload-pages:
    needs: sync
    runs-on: ubuntu-latest
    steps:
      - name: reload
        uses: Mizuka - wu/[email protected]
        with:
          repository: linzowo/linzowo
          cookie: The ${{ secrets.GITEE_COOKIE }}
          branch: gh_pages

Copy the code

A separate description for each job

Vuepress automatic build and Github Page deployment: build-and-deploy

This action comes from vuepress-deploy. If there are ambiguations in the configuration, refer to the project documentation. The vague parts will be explained below.

keywords instructions
secrets. There is a Secrets option in the project Settings to store common values that are accessible in actions
secrets.ACCESS_TOKEN This secrets store is your account token ===> token create step: Click on your avatar > Settings > Developer Settings > Personal Access Tokens > Generate new Tokens. Permissions must be selected at leastrepo, not clear, direct brainless all choose line ~ the problem is not big, do not panic. ===> Save the generated token after creation. Create ACCESS_TOKEN under project secrets and save your generated token

Synchronize GithubPage to GiteEpage: sync

This Action comes from Git Mirror Action. If there are ambiguations in the configuration, refer to the project documentation. The vague parts will be explained below.

keywords instructions
secrets. There is a Secrets option in the project Settings to store common values that are accessible in actions
secrets.GITEE_RSA_PRIVATE_KEY If you don’t know how to generate SSH, please refer to this guideGenerating an SSH Public KeyAfter the corresponding SSH public key is generated. Go to the. SSH folder to obtain the value of the id_RSA file (note that the id_RSA file is suffixed). Just store this value into GITEE_RSA_PRIVATE_KEY. ===> Go to Gitee and store the corresponding public key ===> Go to Gitee ==> Click on your profile picture ==> Click Settings ==> Find the security Settings ==> Find the SSH public key ==> Obtain the value in the id_rsa.pub file in the. SSH folder. Add to the public key of the account using this value

Giteepage deploys automatically: reload-Pages

This action is intended to address the issue of the GiteEpage repository being updated and not being able to deploy automatically. This action comes from Giee-pages-action, if there are unclear parts in the configuration refer to the documentation for this project. The vague parts will be explained below.

keywords instructions
secrets. There is a Secrets option in the project Settings to store common values that are accessible in actions
secrets.GITEE_COOKIE The value stored under this secrets is the value in the rebuild request when you update pages after logging in to Gitee. I have been working on the specific operation stepsgitee-pages-actionDetailed records were taken. You can refer to it for configuration

thanks

Thank you for reading, and I’m glad if this document has been of any help to you.

Thanks also to the open source authors for their contributions

Jenkey2011

required

Edward Mizuka