Skip to content

CircleCI

ZΛNDΞR edited this page Feb 20, 2018 · 1 revision

CircleCI

The basic example of CircleCi config.yml inside the .circleci folder in the project directory.

# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
  build:
    working_directory: ~/<PROJECT_NAME>
    docker:
      # specify the version you desire here
      - image: circleci/node:7.10

      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/

    steps:
      - checkout
      - run:
          name: NPM Install
          command: |
            # Script to set up the project
            npm install
            npm run test
            
      # Based on the branch develop deploy to the staging environment
      - deploy:
          name: Deploy to Staging Website
          command: |
            # Script to deploy the project into staging environment using develop branch
            if [ "${CIRCLE_BRANCH}" == "develop" ]; then
              npm run build;
            else
              echo -e "Not develop branch so not deploying";
            fi

      # Based on the branch master deploy to the main environment
      - deploy:
          name: Deploy to Main Website
          command: |
            # Script to deploy the project into live environment using master branch
            if [ "${CIRCLE_BRANCH}" == "master" ]; then
              npm run build;
            else
              echo -e "Not master branch so not deploying";
            fi

Clone this wiki locally