-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircle.yml
75 lines (74 loc) · 2.45 KB
/
circle.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
version: 2
dependencies:
pre:
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
jobs:
build:
working_directory: ~/js-sdk
docker:
- image: circleci/node:11.15
steps:
- checkout
- restore_cache:
key: build-bin-cache
- run:
name: Temp fix for jessie-updates
command: |
sudo sed -i '/jessie-backports/d' /etc/apt/sources.list
sudo sed -i '/jessie-updates/d' /etc/apt/sources.list
- run:
name: Install runtime
working_directory: ~/build-bin
command: |
sudo apt-get update
sudo apt-get install -y rsync
if [[ ! -f ~/build-bin/aws/bin/aws ]]; then
sudo apt-get install -y python-dev
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
sudo ./awscli-bundle/install -i ~/build-bin/aws
fi
- save_cache:
key: build-bin-cache
paths:
- ~/build-bin
- restore_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: Install dependencies
command: |
yarn
- save_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
paths:
- ./node_modules
- ~/.cache/yarn
- run:
name: Run tests
command: |
yarn test
- run:
name: Build
command: |
yarn build
yarn doc
- store_artifacts:
path: dist
destination: dist
- deploy:
name: Deploy
command: |
if [[ $CIRCLE_BRANCH == "master" ]] || [[ ! -z $CIRCLE_TAG ]]; then
export DEPLOY_TARGET=master
if [[ ! -z $CIRCLE_TAG ]]; then
export DEPLOY_TARGET=$CIRCLE_TAG
fi
mkdir -p package && rsync -av ./ ./package --exclude='package' --exclude='node_modules/' --exclude='.git' && tar -zcvf ./dist/SygicTravelSDK.tgz package && rm -rf package
~/build-bin/aws/bin/aws s3 sync ./dist s3://tripomatic-assets/js-sdk/${DEPLOY_TARGET} --delete --acl public-read
~/build-bin/aws/bin/aws s3 sync ./doc s3://docs.sygictravelapi.com/js-sdk/${DEPLOY_TARGET} --delete --acl public-read
fi
deployment:
npm:
tag: /v[0-9]+(\.[0-9]+)*(\-[a-z0-9]*)*/
commands:
- npm publish