zhaobinglong / myBlog

https://zhaobinglong.github.io/myBlog/
MIT License
7 stars 0 forks source link

持续集成和部署 #17

Open zhaobinglong opened 4 years ago

zhaobinglong commented 4 years ago

git hook钩子自动部署

$res = shell_exec("cd ${path} && sudo git pull 2>&1"); 
echo 'bookediter更新成功:'.date('y-m-d H:i:s');
zhaobinglong commented 3 years ago

基于github Action自动打包和部署

zhaobinglong commented 3 years ago

travis CI自动部署

// 在项目根目录下新建 .travis.yml文件,这是自动构建程序的配置文件
language: node_js
# nodejs版本
node_js: 
    - '6'

# Travis-CI Caching
cache:
  directories:
    - node_modules

# S: Build Lifecycle
install:
  - npm install

before_script:

# 无其他依赖项所以执行npm run build 构建就行了
script:
  - npm run build

after_script:
  # - cd ./dist
  # - git init
  # - git config user.name "${U_NAME}"
  # - git config user.email "${U_EMAIL}"
  # - git add .
  # - git commit -m "Update tools"
  # - git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:${P_BRANCH}
# E: Build LifeCycle

#指定分支,只有指定的分支提交时才会运行脚本
branches:
  only:
    - master
env:
 global:
   # 我将其添加到了travis-ci的环境变量中
   #- GH_REF: github.com/yimogit/metools.git 

参考

https://www.jianshu.com/p/4d7702ccf0aa https://www.jianshu.com/p/f2d3b30265c7 https://www.cnblogs.com/morang/p/7228488.html http://www.ruanyifeng.com/blog/2017/12/travis_ci_tutorial.html https://blog.csdn.net/u011350541/article/details/84034141 https://segmentfault.com/a/1190000011218410?_ea=5032568 https://zhuanlan.zhihu.com/p/25066056