A,githubBasic operation

  • 1. Create a HEXO_blog project

  • 2. Generate a token for a personal account.

    Click your avatar in the upper right corner — Settings >Developer Settings –> Personal Access Tokens –> Genderate New Token

Second, the use ofhexositeThe document address

  • 1. Follow the steps on the website step by step
  • 2. Generate a project to submit to the previousgithubIn the warehouse

Three, use,travisContinuous deployment projectThe website address

  • 1.Travis CIProvides continuous integration services (Continuous Integration, hereinafter referred to asCI). It is bindingGithubThe above project, as long as there is new code, will automatically grab. Then, provide a run environment, perform tests, complete builds, and deploy to the server
  • 2. Continuous integration refers to automating builds and tests whenever code changes and reporting results. After making sure that you are as expected, integrate the new code into the trunk
  • 3. The benefit of continuous integration is that every time you make a small change to your code, you can see the results, accumulating small changes over time, rather than merging a large chunk of code at the end of the development cycle
  • 4,Travis CIOnly supportGithubSo you have to haveGitHubaccount
  • 5. Click the Sign in with GitHub button to log in with your GitHub account

  • 6. Sync projects on Github

  • 7. Synchronize the tokon that was just generated on Github

Four,.travis.ymldocumentation

  • Travis requires that there be a.travis. Yml file in the root directory of the project. This is the configuration file that specifies Travis’ behavior

  • 2. The file must be saved in the Github repository. Travis will go to the file and execute the commands in the repository whenever there is a new Commit

  • 3. This file is in YAML format. Here is a.travis. Yml file for the simplest Node project

  • 4, The language field specifies the default operating environment, all languages in this field

  • Node_js: “11” indicates that no script is executed and the status is set to success

  • 6. Specific Configuration ()

    language: node_js
    node_js:
      - '11'
    install:
      - npm install
    script:
      - hexo g
    after_script:
      - cd ./public
      - git init
      - git config user.name ${USERNAME}
      - git config user.email ${UESREMAIL}
      - git add -A
      - git commit -m 'init'
      - git push -u -f "https://${TOKEN}@github.com/${USERNAME}/hexo_blog" master:gh-pages
    branches:
      only:
        - master
    Copy the code

Five, modify,hexoConfiguration file of

Although the above direct submission code can be published automatically, but the style load does not come out of the official website document

  • 1. Modify the _config.yml file

    url: https://kuangshp.github.io/hexo_blog/
    root: /hexo_blog/
    Copy the code

Six, this timegitSubmit codetravisIt will automatically publish your project for you

7, check static site address (ingithubGo up to the project Settings, scroll down)