-
Notifications
You must be signed in to change notification settings - Fork 12
/
.gitlab-ci.yml
93 lines (86 loc) · 2.28 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
82
83
84
85
86
87
88
89
90
91
92
93
stages:
- build
- release
variables:
CACHE_FALLBACK_KEY: master
image: registry.gitlab.com/id5-sync/infrastructure/ci-image-node-google-chrome:18.4.0-102.0.5005.61-2
build:
stage: build
script:
- npm install --global gulp-cli
- npm ci
- npm run build:all
artifacts:
paths:
- build/
cache:
paths:
- "$CI_PROJECT_DIR/node_modules"
key: $CI_COMMIT_REF_SLUG
prepare_release:
stage: release
rules:
- if: $CI_COMMIT_TAG
when: never
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ "/^Release v.*/"
when: manual
before_script:
- git config user.email $GITLAB_USER_EMAIL
- git config user.name $GITLAB_USER_LOGIN
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no \n\n" > ~/.ssh/config'
- git checkout -B "$CI_COMMIT_REF_NAME"
- git remote rm origin && git remote add origin "[email protected]:id5-sync/id5-api.js.git"
script:
- npm run prepare_release
- npm ci
- npm run build:all
- git push origin HEAD:$CI_COMMIT_REF_NAME --tags
artifacts:
paths:
- build/
cache:
paths:
- "$CI_PROJECT_DIR/node_modules"
key: $CI_COMMIT_REF_SLUG
gitlab_release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/
when: manual
script:
- echo "Create release $CI_COMMIT_TAG"
release:
tag_name: $CI_COMMIT_TAG
description: ./release_notes/$CI_COMMIT_TAG.md
cache:
paths:
- "$CI_PROJECT_DIR/node_modules"
key: $CI_COMMIT_REF_SLUG
github_release:
stage: release
rules:
- if: $CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/
when: manual
script:
- bash release-github.sh $CI_COMMIT_TAG
cache:
paths:
- "$CI_PROJECT_DIR/node_modules"
key: $CI_COMMIT_REF_SLUG
npm_release:
stage: release
rules:
- if: $CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/
when: manual
script:
- echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc
- npm run npm_prepare_release
- bash release-npm.sh
cache:
paths:
- "$CI_PROJECT_DIR/node_modules"
key: $CI_COMMIT_REF_SLUG