Travis CI 的部署 - lemondante/TechFileWriting1 GitHub Wiki
获取 Github Personal Access Tokens
在 Travis CI 上设置仓库信息与环境变量
注意:请将Token设置为私密状态,否则会被Github收回。
撰写 .travis.yml 文件
language: python
branches:
only:
- main # 需要编译的分支
install:
- pip install sphinx # sphinx
- pip install recommonmark
- pip install sphinx-rtd-theme
- pip install oe-sphinx-theme
script:
- cd googleanalytics
- python setup.py install #google analytics
- cd ..
- make html
deploy:
provider: pages
skip-cleanup: true
github-token: $GITHUB_TOKEN # github 上的token环境变量 #在网页上手动设置
local-dir: ./_build/html # 根据情况自定义到静态文件输出目录,是main里的目录
target-branch: gh-pages
verbose: true
on:
branch: main #main提交时才会运行