-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
67 lines (60 loc) · 1.35 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# SPDX-FileCopyrightText: 2017 Roberto MF (Roboe)
# SPDX-FileCopyrightText: 2021 Álvaro Cuesta (alvaro-cuesta)
#
# SPDX-License-Identifier: CC0-1.0
stages:
- test
- build
- deploy
variables:
SOURCE: $CI_PROJECT_DIR
BUILD_DESTINATION: $CI_PROJECT_DIR/build
GIT_PUSH_URL: https://$GITLAB_USER_LOGIN:[email protected]/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME.git
GIT_PUSH_BRANCH: master:gh-pages
cache:
key:
files:
- package-lock.json
paths:
- .npm/
reuse_lint:
stage: test
image:
name: fsfe/reuse:latest
entrypoint: ['']
script:
- reuse --root $CI_PROJECT_DIR lint
npm_test:
stage: test
image: node:latest
before_script:
- npm ci --cache .npm --prefer-offline
script:
- npm test
npm_build:
stage: build
image: node:latest
before_script:
- npm ci --cache .npm --prefer-offline
script:
- npm run build
artifacts:
paths:
- build
expire_in: 1 week
git_deploy:
image: alpine:latest
stage: deploy
only:
- master
when: on_success
before_script:
- apk add --no-cache git
script:
- cd $BUILD_DESTINATION
- git init
- git config user.name "$GITLAB_USER_NAME"
- git config user.email "$GITLAB_USER_EMAIL"
- git add --all
- git commit -m "Deploy $CI_COMMIT_SHA"
- git push --force --quiet $GIT_PUSH_URL $GIT_PUSH_BRANCH > /dev/null 2>&1