.gitlab-ci.yml 1.15 KB
Newer Older
Fabio Busatto's avatar
Fabio Busatto committed
1
2
3
4
5
# This file is a template, and might need editing before it works on your project.
# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/node/tags/
image: node:latest

Fred Chasen's avatar
Fred Chasen committed
6
7
8
9
10
stages:
  - test
  - deploy
  - publish

Fabio Busatto's avatar
Fabio Busatto committed
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
cache:
  paths:
  - node_modules/

test:
  stage: test
  script:
    - npm install
    - npm test

pack:
  stage: deploy
  script:
    - npm install
    - npm pack
  artifacts:
    paths:
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
    - ./*.tgz

# This job requires to setup GitLab the following way:
# 1. On https://www.npmjs.com/settings/tokens/create
#     create a new read/write token (the logged in user must have write access for the `pagedjs` package)
# 2. On https://gitlab.pagedmedia.org/tools/pagedjs/-/settings/ci_cd#js-cicd-variables-settings
#     add a new variable named `NPM_TOKEN`, and toggle on _Protected_ and _Masked_
npm-publish:
  stage: publish
  before_script:
    - 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc'
    - npm install
    - npm publish --public --dry-run
  script:
    - npm publish --public
  only:
    - tags