language: node_js

stages:
  - name: test
    # DEBUG: Don't run the tests so we can test-run the rest of the script
    if:
      - branch != add_pages

  - name: publish module
    if:
      - branch = master
      - tag IS present
      - repo = ocadotechnology/hexagonjs

  - name: publish docs
    if:
      # DEBUG: Use current branch instead of master
      - branch = add_pages
      - repo = ocadotechnology/hexagonjs
      - type = push

node_js:
  - "9"
  - "8"
  - "7"
  - "6"

jobs:
  include:
    - stage: test
      script: npm test && npm run combine-coverage && npm run upload-coverage

    - stage: publish module
      script: skip
      node_js: "6"
      deploy:
        provider: npm
        email: hexagonj.ci.noreply@ocado.com
        api_key:
          secure: $GITHUB_TOKEN

    - stage: publish pages
      script: cd docs && npm install && npm run clean && npm run build
      node_js: "8"
      deploy:
        provider: pages
        local-dir: docs/public
        email: hexagonj.ci.noreply@ocado.com
        github-token: $GITHUB_TOKEN
        skip-cleanup: true
        keep-history: true

language: node_js

stages:
  - name: test
    # DEBUG: Don't run the tests so we can test-run the rest of the script
    if: branch != add_pages

  - name: publish module
    if: tag IS present AND branch = master AND repo = ocadotechnology/hexagonjs

  - name: publish docs
    # DEBUG: Use current branch instead of master
    if: type = push AND branch = add_pages AND repo = ocadotechnology/hexagonjs

node_js:
  - "9"
  - "8"
  - "7"
  - "6"

jobs:
  include:
    - stage: test
      script: npm test && npm run combine-coverage && npm run upload-coverage

    - stage: publish module
      script: skip
      node_js: "6"
      deploy:
        provider: npm
        email: hexagonj.ci.noreply@ocado.com
        api_key:
          secure: $GITHUB_TOKEN

    - stage: publish pages
      script: cd docs && npm install && npm run clean && npm run build
      node_js: "8"
      deploy:
        provider: pages
        local-dir: docs/public
        email: hexagonj.ci.noreply@ocado.com
        github-token: $GITHUB_TOKEN
        skip-cleanup: true
        keep-history: true

Use correct syntax for conditional stages
chore(ci): Use correct syntax for conditional stages
