Blog via Travis-CI

Hits: 0

Through Travis CI, after adding a new blog, the corresponding site is automatically generated and uploaded to Github Page.

Generate Personal access tokens in Github

Add authentication information:

Add the corresponding environment variable to the Setting page of your Travis CI repository. The variable name is GITHUB_TOKEN and the value is the Personal access tokens created earlier.

Write CI files

Write the corresponding .travis.yml file

sudo: true
dist: trusty

  - sudo apt-get --yes install snapd
  - sudo snap install hugo

  - /snap/bin/hugo

  provider: pages
  skip-cleanup: true
  github-token: $GITHUB_TOKEN
  keep-history: true
  target-branch: master
  local-dir: public
    branch: src

Parameter explanation :

  • target-branch: Generated site target push branch
  • local-dir: the folder path where the generated site is located

You may also like...

Leave a Reply

Your email address will not be published.