forked from pedrohusky/binance-trading-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
38 lines (34 loc) · 949 Bytes
/
.gitlab-ci.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
stages:
- testing
- release
- build production
cache:
key: '$CI_PIPELINE_ID'
paths:
- /root/.cache
- /root/.npm
- node_modules
.before_script_template: &before-script
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $REGISTRY_DOMAIN
testing:
stage: testing
image: node:14
script:
- npm install
- npm run lint
- npm run test
production:
stage: build production
image: docker:stable-git
only:
- master
<<: *before-script
script:
- PACKAGE_VERSION=$(grep -m1 version package.json | cut -c 15- | rev | cut
-c 3- | rev)
- GIT_HASH=$(git rev-parse --short HEAD)
- docker build . --build-arg PACKAGE_VERSION=$PACKAGE_VERSION --build-arg
GIT_HASH=$GIT_HASH --build-arg NODE_ENV=production --target
production-stage -t $REGISTRY_DOMAIN/chrisleekr/binance-trading-bot:latest
- docker push $REGISTRY_DOMAIN/chrisleekr/binance-trading-bot:latest