zoukankan      html  css  js  c++  java
  • CircleCi 不更新某个分支的两种方法

    概述

    今天我发现我的所有项目的 CircleCi 部署全部都会更新 gh-pages 分支。找了好久,终于找到了不更新的方法。于是我总结了一下,记录下来,供以后开发时参考,相信对其他人也有用。

    only 方法

    其实在 config.yml 文件的 build 里面加入 branches 字段,就会只更新 master 分支,示例如下:

    version: 2
    jobs:
      build:
        branches:
          only:
              - master
    
        docker:
          # specify the version you desire here
          - image: circleci/node:latest
          # 其它配置
          # ...
    

    如果不想更新 xxx 分支的话,可以使用下面的写法:

    version: 2
    jobs:
      build:
        branches:
          ignore:
              - xxx
              - xxx
    
        docker:
          # specify the version you desire here
          - image: circleci/node:latest
          # 其它配置
          # ...
    

    ci skip

    但是上面的写法不适用于 gh-pages 分支。如果要 CircleCi 自动更新 gh-pages 分支,但是这个更新不触发 CircleCi 的话,需要在部署脚本的 commit 信息里面加入 [ci skip],示例如下:

    git pull
    yarn build:doc
    cd docs
    git init
    git config --global user.email "you@example.com"
    git config --global user.name "sishenhei7"
    git add .
    git commit -m 'deploy: build docs[ci skip]'
    git push -f git@github.com:sishenhei7/digit-flip.git  master:gh-pages
    cd -
    
  • 相关阅读:
    v-cloak
    MVVM
    初识ajax
    装瓶学习法
    回调函数(call back)
    如何让学习变得纯粹?
    异步
    grep用法
    Shell中的&&与||的区别
    shell中使用>/dev/null 2>&1 丢弃信息
  • 原文地址:https://www.cnblogs.com/yangzhou33/p/11657637.html
Copyright © 2011-2022 走看看