-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
84 lines (71 loc) · 1.66 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
image: node:20-alpine
stages:
- test
- build
- release
## Install stage ###################################################################
install:
stage: .pre
script:
- npm ci --cache .npm --prefer-offline
- npm install
cache:
- key: ${CI_JOB_NAME}
paths:
- .npm/
when: on_success
artifacts:
paths:
- node_modules/
## Test stage ###################################################################
test:
stage: test
needs:
- job: install
script:
- npm run test
test-js-build:
stage: test
needs:
- job: install
artifacts: true
script:
- npm run build
lint:
stage: test
needs:
- job: install
artifacts: true
script:
- npm run lint
## Build stage ###################################################################
build:
stage: build
script:
- npm run build
- >
if [ -n "${CI_COMMIT_TAG}" ]; then
VERSION="$(echo "${CI_COMMIT_TAG}" | sed -nE 's/v([0-9]+)\.([0-9]+)\.([0-9]+).*/\1.\2.\3/p')"
else
VERSION="${CI_COMMIT_SHORT_SHA}-dev"
fi
- mv dist turris-webapps-${VERSION}
- cp turris-root.conf turris-webapps-json-cgi turris-webapps-${VERSION}/
- tar cvzf "turris-webapps-${VERSION}.tar.gz" turris-webapps-${VERSION}
artifacts:
paths:
- turris-webapps-*.tar.gz
## Release stage ###################################################################
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: "$CI_COMMIT_TAG"
needs:
- job: build
artifacts: true
before_script:
- apk update
- apk add bash curl
script:
- .gitlab-ci/release.sh