Skip to content

Commit

Permalink
Merge pull request #316 from Syncano/chore/circleCi-cookbook
Browse files Browse the repository at this point in the history
CircleCI cookbook
  • Loading branch information
jonny22094 committed Nov 19, 2018
2 parents 2efe58d + 71ad30c commit dbe50f9
Showing 1 changed file with 71 additions and 22 deletions.
93 changes: 71 additions & 22 deletions docs/cookbook/web/deployment/circle-ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <PATH>
```

Next step is to go to your Syncano project folder and create CircleCI config file:

```sh
cd ~/my_syncano_project/
Expand All @@ -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:
Expand All @@ -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.

0 comments on commit dbe50f9

Please sign in to comment.