machine:
  node:
    version: 4.3.0

test:
  override:
    # Lint
    - npm run lint
    # Run unit tests
    - npm run test
    # Test gh-pages build
    - rm -rf node_modules/
    - git checkout gh-pages
    - npm install
    - if [ -z ${CIRCLE_PR_USERNAME}]; then npm install ${CIRCLE_REPOSITORY_URL}.git\#${CIRCLE_SHA1}; else npm install git+https://git@github.com/${CIRCLE_PR_USERNAME}/${CIRCLE_PR_REPONAME}.git\#${CIRCLE_SHA1}; fi
    - gulp build

deployment:
  production:
    branch: master
    commands:
      # Publish to NPM
      - echo -e "$NPM_USERNAME\n$NPM_PASSWORD\n$NPM_EMAIL" | npm login
      - git checkout -f master
      - npm install publish
      - npm run npmPublish
      # Update gh-pages demo site
      - git config --global user.email circleci@circleci
      - git config --global user.name CircleCI
      - rm -rf node_modules/
      - rm -rf tests/
      - git checkout gh-pages
      - npm install
      - gulp build
      - git status
      - git commit dist/ --allow-empty -m "Circle CI - validator demo update"
      - git push origin gh-pages

machine:
  node:
    version: 4.3.0

test:
  override:
    # Lint
    - npm run lint
    # Run unit tests
    - npm run test
    # Test gh-pages build
    - rm -rf node_modules/
    - git checkout gh-pages
    - npm install
    - if [ -z ${CIRCLE_PR_USERNAME}]; then npm install ${CIRCLE_REPOSITORY_URL}.git\#${CIRCLE_SHA1}; else npm install git+https://git@github.com/${CIRCLE_PR_USERNAME}/${CIRCLE_PR_REPONAME}.git\#${CIRCLE_SHA1}; fi
    - gulp build

deployment:
  production:
    branch: master
    commands:
      # Publish to NPM
      - echo -e "$NPM_USERNAME\n$NPM_PASSWORD\n$NPM_EMAIL" | npm login
      - git checkout -f master
      - npm install publish
      - npm run npmPublish
      # Update gh-pages demo site
      - git config --global user.email circleci@circleci
      - git config --global user.name CircleCI
      - rm -rf node_modules/
      - rm -rf tests/
      - git checkout gh-pages
      - git pull
      - npm install
      - gulp build
      - git status
      - git commit dist/ --allow-empty -m "Circle CI - validator demo update"
      - git push origin gh-pages

Add git pull to gh-pages checkout
Add git pull to gh-pages checkout
