-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
81 lines (74 loc) · 2.45 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
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
75
76
77
78
79
80
81
image: 'node:latest'
workflow:
rules:
- if: $CI_COMMIT_MESSAGEE =~ /wip/
when: never
- if: $CI_PIPELINE_TRIGGERED
when: always
- if: $CI_COMMIT_TAG
when: always
- if: $CI_COMMIT_MESSAGE =~ /ci/ && $CI_COMMIT_MESSAGE =~ /force/
when: always
- if: $CI_COMMIT_MESSAGE =~ /ci/
when: never
- if: $CI_COMMIT_MESSAGE =~ /fix/ || $CI_COMMIT_MESSAGE =~ /evol/ || $CI_COMMIT_MESSAGE =~ /major/
when: always
- when: never
stages:
- build
- release
cache:
paths:
- node_modules/
build:
stage: build
variables:
GITLAB_TOKEN: $CI_API_TOKEN
before_script:
- npm install -g semantic-release @semantic-release/gitlab @semantic-release/npm @semantic-release/gitlab-config conventional-changelog-conventionalcommits
- git remote set-url origin https://$GIT_CI_USER:$CI_API_TOKEN@gitlab.com/$CI_PROJECT_PATH.git
- git config --global user.email "${GITLAB_USER_EMAIL}"
- git config --global user.name "gitlab runner"
script:
- semantic-release
- npm install -g pkg
- npm install
- pkg . -t node12-linux-x64 -o isxer
- git add package.json
- "git commit -m 'ci(package.json): bump version'"
- git push origin HEAD:master
- git push --delete origin v$(npm --loglevel silent run version )
artifacts:
expire_in: 30 days
paths:
- isxer
only:
- master
release:
stage: release
variables:
GITLAB_TOKEN: $CI_API_TOKEN
before_script:
- npm install -g semantic-release @semantic-release/gitlab @semantic-release/npm @semantic-release/gitlab-config conventional-changelog-conventionalcommits
- git remote set-url origin https://$GIT_CI_USER:$CI_API_TOKEN@gitlab.com/$CI_PROJECT_PATH.git
- git config --global user.email "${GITLAB_USER_EMAIL}"
- git config --global user.name "gitlab runner"
script:
- git pull origin master
- cat $SEM_RELEASE_OPTIONS > .releaserc
- semantic-release -e @semantic-release/gitlab-config
only:
- master
docker:
stage: release
image: docker:latest
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build --pull -t "$CI_REGISTRY_IMAGE:${CI_COMMIT_TAG}" -t "$CI_REGISTRY_IMAGE:latest" .
- docker push "$CI_REGISTRY_IMAGE:${CI_COMMIT_TAG}"
- docker push "$CI_REGISTRY_IMAGE:latest"
only:
- tags