-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.gitlab-ci.yml
73 lines (63 loc) · 1.25 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
image: node:latest
.docker: &docker
tags:
- docker
before_script:
- npm install
cache:
paths:
- node_modules/
stages:
- build
- test
- deploy
# Verify it can build.
build:
<<: *docker
stage: build
artifacts:
paths:
- dist
expire_in: 1 week
script:
- npm run build
# Verify it passes linting.
test:lint:
<<: *docker
stage: test
script:
- npm run lint
# Pass Karma
# test:karma:
# <<: *docker
# stage: test
# script:
# - npm run test
# Push to GITHUB
deploy:github:
<<: *docker
stage: deploy
only:
- tags
script:
# Setup ssh with the key and trust the destination.
- eval $(ssh-agent -s)
- echo "${GITHUB_TOKEN}" | ssh-add -
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
# (Re)configure git and push w/ tags.
- git config user.name "${GITHUB_USER_NAME}"
- git config user.email "${GITHUB_USER_EMAIL}"
- git remote set-url origin ${GITHUB_REPO}
- git push origin master --follow-tags
# Push to NPM
deploy:npm:
<<: *docker
stage: deploy
only:
- tags
script:
# Build the library, publish dist.
- echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- npm run build
- npm run dist