-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
37 lines (35 loc) · 997 Bytes
/
.gitlab-ci.yml
File metadata and controls
37 lines (35 loc) · 997 Bytes
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
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: never
- if: '$CI_COMMIT_BRANCH == "master"'
when: always
- if: '$CI_COMMIT_BRANCH == "beta"'
when: always
image: node:latest
stages:
- deploy
deploy:
stage: deploy
script:
- npm install
- npm run build
- echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
- |
VERSION=$(node -p -e "require('./package.json').version")
if [ "$CI_COMMIT_BRANCH" == "master" ]; then
if [[ "$VERSION" == *"-"* ]]; then
echo "Error: Version for master branch must not contain pre-release identifiers"
exit 1
fi
npm publish --access public
elif [ "$CI_COMMIT_BRANCH" == "beta" ]; then
if [[ "$VERSION" != *"beta"* ]]; then
echo "Error: Version for beta branch must include 'beta'"
exit 1
fi
npm publish --tag beta -f --access public
fi
only:
- master
- beta