-
Notifications
You must be signed in to change notification settings - Fork 8
/
.gitlab-ci.yml
80 lines (72 loc) · 1.72 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
variables:
GIT_DEPTH: 50
# Mixins
.only_any_v_tags:
only:
- /^v[0-9]+\.[0-9]+\.[0-9]+/
except:
- branches
.only_release_v_tags:
only:
- /^v[0-9]+\.[0-9]+\.[0-9]+$/
except:
- branches
.job_test:
stage: test
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_TAG
before_script:
- npm ci --ignore-scripts
stages:
- test
- build-addon
- publish
# Test stage
lint:
extends:
- .job_test
script:
- npm run lint
typecheck:
extends:
- .job_test
script:
- npm run typecheck
# Build-addon stage
build-addon-windows:
extends:
- .only_any_v_tags
stage: build-addon
tags:
- win
before_script:
- npm ci --ignore-scripts
script:
- npm run prebuild -- --arch x64 --upload $PREBUILD_GH_TOKEN
- npm run prebuild -- --arch ia32 --upload $PREBUILD_GH_TOKEN
needs:
- lint
- typecheck
# Publish stage
build-library:
extends:
- .only_any_v_tags
stage: publish
before_script:
- npm ci --ignore-scripts
script:
- npm run build:ts
- npm set //registry.npmjs.org/:_authToken $NPM_TOKEN
- npm publish --access public
- LAST_RELEASE="$(git describe --abbrev=0 --tags ${CI_COMMIT_TAG}^)"
- CHANGELOG="$(git diff -U0 $LAST_RELEASE $CI_COMMIT_TAG CHANGELOG.md | grep -E "^\+" | grep -vE "^\+\+\+" | grep -vE "^\+#+ \[" | sed "s/^\+//")"
- >
curl -sSL -X POST -H "JOB-TOKEN: $CI_JOB_TOKEN" -H "Content-type: application/json" -d "{ \"name\": $(echo $CI_COMMIT_TAG | jq -Ra .), \"tag_name\": $(echo $CI_COMMIT_TAG | jq -Ra .), \"description\": $(echo "$CHANGELOG" | jq -Rsa .) }" ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/releases
artifacts:
paths:
- dist
expire_in: 12h
needs:
- lint
- typecheck