-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
116 lines (104 loc) · 2.43 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
variables:
ADDON_BUILD_IMAGE: "gitlab.paymoapp.com:5555/envscripts/img-ubuntu-widget-build"
GIT_DEPTH: 50
XCODE_TOOLS: "/Applications/Xcode14_3_1.app"
# 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
.job_build_addon:
stage: build-addon
before_script:
- npm ci --ignore-scripts
script:
- npm run prebuild -- --upload $PREBUILD_GH_TOKEN
needs:
- lint
- typecheck
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
- .job_build_addon
tags:
- win
build-addon-mac-x64:
extends:
- .only_any_v_tags
- .job_build_addon
tags:
- osx
hooks:
pre_get_sources_script:
- sudo xcode-select -s $XCODE_TOOLS
script:
- npm run prebuild -- --arch x64 --upload $PREBUILD_GH_TOKEN
build-addon-mac-arm64:
extends:
- .only_any_v_tags
- .job_build_addon
tags:
- osx
hooks:
pre_get_sources_script:
- sudo xcode-select -s $XCODE_TOOLS
script:
- npm run prebuild -- --arch arm64 --upload $PREBUILD_GH_TOKEN
build-addon-linux:
extends:
- .only_any_v_tags
- .job_build_addon
image: $ADDON_BUILD_IMAGE
tags:
- docker
# 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