Making the home page

Each GitHub account has a home site and numerous project sites

You get one site per GitHub account and organization, and unlimited project sites.

Pay attention to the configuration of the common path during deployment. Otherwise, 404 will appear

If you are not using a custom domain name, then do not forget to specify that your project is not hosted at the server root.

// The vUE project needs to add the repository prefix as publicPath at deployment time
module.exports = {
    publicPath: process.env.NODE_ENV === 'production'
        ? '/repository-name/'
        : '/'
}
// React project adds a homepage field to package.json and changes the user name and repository name
"homepage":"https://yourusername.github.io/repository-name"
Copy the code

github flow

Create a.github/workflows/ path in the project root directory and configure a YAML file with an arbitrary name. Github will deploy automatically after a push operation

github actions

GitHub continuous deployment is the process of executing actions step by step. You don’t have to write your own actions files. GitHub officially maintains an Actions marketplace

Each action is a separate script, so it can be a repository that references the action using the userName/repoName syntax. For example, actions/setup-node represents the github.com/actions/setup-node repository, which represents an action to install Node.js. In fact, GitHub’s official actions are located at github.com/actions. Since actions are a repository of code, there is of course a concept of version, and users can refer to a specific version of an action. The following are all valid action references using Git’s pointer concept.

Actions /setup-node@74bc508 # point to a commit Actions /[email protected] # point to a tag Actions /setup-node@master # point to a branchCopy the code

Github Flow Configures demo

name: buildAndDeploy.
on:
  # Triggers the workflow on push or pull request events but only for the main branch
  push:
    branches: [ main ]
  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest
    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      - name: step one
        # Uses the default branch of a public repository
        # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work  correctly.
        uses: actions/checkout@v2 
        with:
          persist-credentials: false
      - name: Install and Build
        run: | npm install npm run build      - name: Deploy
        uses: JamesIves/github-pages-deploy-action@releases/v3
        with:
          ACCESS_TOKEN: The ${{ secrets.ACCESS_TOKEN }} See the reference link below for # token generation
          BRANCH: project-pages
          FOLDER: dist
Copy the code

Refer to the link

  • Making the document
  • Deploy your projects to Github Pages with GitHub Actions
  • GitHub Actions tutorial
  • Creating a personal access token