-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
48 lines (41 loc) · 1.09 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
image: node:14-buster
include:
- template: Security/SAST.gitlab-ci.yml
cache:
paths:
- node_modules
- version.txt
- dist
stages:
- build
- deploy
semgrep-sast:
cache: {}
sast:
stage: build
build:
stage: build
script:
- echo -e "@${CI_PROJECT_ROOT_NAMESPACE}:registry=${CI_API_V4_URL}/packages/npm/" > .npmrc
- if [[ -f ./version.txt ]]; then eval "npm version $(cat version.txt) --allow-same-version --force --no-git-tag-version"; npm version patch --force --no-git-tag-version; fi;
- npm install
- npm run build
- node -e 'console.log(require("./package.json").version);' > version.txt
- cat version.txt
allow_failure: false
artifacts:
paths:
- dist
when: on_success
only:
- merge_requests
- master
publish:
stage: deploy
script:
- cd dist
- echo -e "@${CI_PROJECT_ROOT_NAMESPACE}:registry=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/npm/" > .npmrc
- echo -e "${CI_API_V4_URL#https?}/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}" >> .npmrc
- npm publish
only:
- master