/
.gitlab-ci.yml
50 lines (43 loc) · 1004 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
39
40
41
42
43
44
45
46
47
48
49
image: registry.gitlab.com/ecloud/ci-runners/native:2_0_0
stages:
- test
- release
before_script:
- npm install
variables:
PROJECT: "component"
test_master:
stage: test
script:
- npm version
- npm test
- npm run lint
artifacts:
paths:
- node_modules
only:
- master@ECloud/component
- triggers
test:
stage: test
script:
- npm version
- npm test
except:
- master@ECloud/component
- triggers
publish:
stage: release
script:
- |
BEFORE=$( npx -c 'echo "$npm_package_version"' )
npx semantic-release
AFTER=$( npx -c 'echo "$npm_package_version"' )
if [[ $BEFORE != $AFTER ]]; then
LAST_COMMIT=$( git rev-parse HEAD ) && git checkout master && git merge $LAST_COMMIT
git remote add gitlab https://oauth2:$GLB_TOKEN@gitlab.com/$CI_PROJECT_PATH.git
git push gitlab master
LAST_VERSION=$( git describe --tags ) && git push gitlab $LAST_VERSION
fi
only:
- master