.gitlab-ci.yml 833 Bytes
Newer Older
1 2 3
stages:
  - build
  - publish
Fred Chasen's avatar
Fred Chasen committed
4

5 6 7
npm-test:
  stage: build
  before_script:
Fred Chasen's avatar
Fred Chasen committed
8
    - docker build -t pagedmedia/pagedjs .
9
  script:
10
    - docker run --security-opt 'seccomp=seccomp.json' pagedmedia/pagedjs npm test
11 12 13 14 15 16 17 18 19 20

# 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'
21
    - npm install
22 23 24 25 26
    - npm publish --public --dry-run
  script:
    - npm publish --public
  only:
    - tags