forked from thorjeus/binance-trading-bot-3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
46 lines (41 loc) · 1.34 KB
/
.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
39
40
41
42
43
44
45
46
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
bump-version-patch:
stage: release
image: node:14
only:
- master
script:
- git config --global user.email "$GIT_CI_EMAIL"
- git config --global user.name "$GIT_CI_NAME"
- npm version patch -m "Update version to %s [skip ci]"
- git push https://$GIT_CI_USERNAME:$GIT_CI_PASSWORD@$GIT_REPO_DOMAIN/chrisleekr/binance-trading-bot.git HEAD:master
production:
stage: build production
image: docker:stable
only:
- master
<<: *before-script
script:
- PACKAGE_VERSION=$(grep version package.json | cut -c 15- | rev | cut -c 3- | rev)
- docker build . --build-arg PACKAGE_VERSION=$PACKAGE_VERSION --build-arg NODE_ENV=production --target production-stage -t $REGISTRY_DOMAIN/chrisleekr/binance-trading-bot:latest -t $REGISTRY_DOMAIN/chrisleekr/binance-trading-bot:$PACKAGE_VERSION
- docker push $REGISTRY_DOMAIN/chrisleekr/binance-trading-bot:$PACKAGE_VERSION
- docker push $REGISTRY_DOMAIN/chrisleekr/binance-trading-bot:latest