diff --git a/docs/cookbook/web/deployment/circle-ci.md b/docs/cookbook/web/deployment/circle-ci.md index 198604cf..cb44270f 100644 --- a/docs/cookbook/web/deployment/circle-ci.md +++ b/docs/cookbook/web/deployment/circle-ci.md @@ -3,11 +3,35 @@ * Preparation time: **3 minutes** * Requirements: - Initiated Syncano project - - CircleCI account (https://circleci.com/) + - [Understand Syncano hosting](https://0-docs.syncano.io/#/project/hosting) + - [CircleCI account](https://circleci.com/) + +### Problem to solve + +You want to configure CircleCi for Syncano project. + +### Solution ### Create CircleCI configuration file -First step is to go to you Syncano project folder and create CircleCI config file: +First you should create syncano.yml in your project folder: + +```yaml +hosting: + website: + src: ../.build/website + config: + browser_router: true + +``` + +If you will create hosting from cli this file above will be created automatically. + +```sh +npx s hosting add +``` + +Next step is to go to your Syncano project folder and create CircleCI config file: ```sh cd ~/my_syncano_project/ @@ -17,25 +41,50 @@ touch circle.yml Now edit `circle.yml` file: ```yaml -machine: - node: - version: 7 - environment: - PATH: "${PATH}:${HOME}/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin" - -dependencies: - override: - - npm install @syncano/cli - -test: - override: - - exit 0 - -deployment: - production: - branch: master - commands: - - npx s deploy +version: 2 + +jobs: + install: + docker: + - image: circleci/node + working_directory: ~/repo + steps: + - checkout + - restore_cache: + keys: + - v1-dependencies-{{ checksum "package.json" }} + - run: + name: Installing Dependencies + command: npm i + - save_cache: + paths: + - node_modules + key: v1-dependencies-{{ checksum "package.json" }} + - persist_to_workspace: + root: . + paths: + - node_modules + upload-website: + docker: + - image: circleci/node + working_directory: ~/repo + steps: + - checkout + - attach_workspace: + at: . + - run: + name: Uploading website and setting CNAME + command: | + npx s hosting sync website + npx s hosting config website -b true # --cname YOUR_CNAME +workflows: + version: 2 + build-test-deploy: + jobs: + - install + - upload-website: + requires: + - install ``` Now add this file to your repository: @@ -46,4 +95,4 @@ git commit -m "CircleCi config file" git push ``` -Next step is to log in to CircleCI dashboard got to the `Projects` tab and add a project using `Add project` button. +Next step is to log in to CircleCI dashboard and go to the `Projects` tab and add a project using `Add project` button.