-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
51 lines (44 loc) · 1.65 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
49
50
51
image: node:16.15.0
stages:
- build
- release
before_script:
- |
if [[ ! -f .npmrc ]]; then
echo 'No .npmrc found! Creating one now. Please review the following link for more information: https://docs.gitlab.com/ee/user/packages/npm_registry/index.html#project-level-npm-endpoint-1'
{
echo "@${CI_PROJECT_ROOT_NAMESPACE}:registry=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/npm/"
echo "${CI_API_V4_URL#http*:}/packages/npm/:_authToken=${CI_JOB_TOKEN}"
echo "${CI_API_V4_URL#http*:}/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}"
} >> .npmrc
fi
- echo "Created the following .npmrc:"; cat .npmrc
- git config user.email $GITLAB_USER_EMAIL
- git config user.name $GITLAB_USER_NAME
- git remote set-url origin "https://gitlab-ci-token:$GL_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH.git"
# - git checkout $CI_COMMIT_BRANCH
build:
stage: build
only:
- master
script:
- yarn install --frozen-lockfile
- yarn build
artifacts:
paths:
- packages/*/dist/
- examples/*/dist/
expire_in: 1 week
release:
stage: release
script:
- PKG=${CI_COMMIT_TAG%%/*}
- echo "Building ${PKG}..."
- yarn install --frozen-lockfile
- yarn build --scope "@${CI_PROJECT_NAMESPACE}/${PKG}"
- echo "Release ${PKG}..."
- cd "packages/$PKG" && npm publish --registry ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/npm/
# - yarn release --loglevel debug --registry ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/npm/
rules:
# Only publish if tag given, format is `package/RELEASE-`. Only one is supported!
- if: '$CI_COMMIT_TAG'