UNPKG

1.78 kBYAMLView Raw
1before_script:
2# Install yarn
3# ref: https://yarnpkg.com/zh-Hans/docs/install#linux-tab
4# - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
5# - echo "deb http://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
6# - apt-get update -y
7# - apt-get install yarn -y
8# install ssh-agent
9# ref: https://docs.gitlab.com/ee/ci/ssh_keys/README.html
10- 'which ssh-agent || ( apt-get install openssh-client -y )'
11# run ssh-agent
12- eval $(ssh-agent -s)
13# add ssh key stored in SSH_PRIVATE_KEY variable to the agent store
14# - ssh-add <(echo "$SSH_PRIVATE_KEY")
15# disable host key checking (NOTE: makes you susceptible to man-in-the-middle attacks)
16# WARNING: use only in docker container, if you use it with shell you will overwrite your user's ssh config
17- mkdir -p ~/.ssh
18- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
19- pwd
20- which nodejs
21- nodejs -v
22- which npm
23- npm -v
24- which yarn
25- yarn --version
26- yarn config set cache-folder .yarn
27
28cache:
29 key: "$CI_BUILD_REF_NAME"
30 paths:
31 - node_modules/
32 - .yarn/
33
34# jobs sequense pipeline
35stages:
36- test
37- build
38- deploy
39
40# test job: lint, test project
41test:
42 tags:
43 - node-10
44 script:
45 - yarn install
46 - npm run lint
47 - npm run test
48 stage: test
49
50# build job: build project and upload artifacts for deploy
51build:
52 # It would upload artifacts to gitlab and next stage for deploy
53 artifacts:
54 name: "${CI_BUILD_REF_NAME}_${CI_BUILD_REF}"
55 expire_in: 1 day
56 paths:
57 - _public/
58 tags:
59 - node-10
60 script:
61 - yarn install
62 - npm run build
63 stage: build
64
65# deploy job
66deploy:
67 tags:
68 - node-10
69 script:
70 - yarn install
71 # You should add deploy script here
72 environment:
73 name: demo
74 url: http://demo.25sprout
75 stage: deploy
76 only:
77 - master