-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
143 lines (122 loc) · 3.19 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
stages:
- .pre
- build
- test
- deploy
variables:
GIT_DEPTH: 0
GIT_STRATEGY: clone
GIT_SUBMODULE_STRATEGY: recursive
include:
- project: 'hive/common-ci-configuration'
ref: 9ec7fd2e0a2491ed808aa1358788a786db9ec035
file:
- '/templates/npm_projects.gitlab-ci.yml'
default:
tags:
- public-runner-docker
lint:
stage: .pre
extends: .npm_based_job_base
script:
- npm run lint-ci
build:
stage: build
extends: .npm_build_template
variables:
DIST_DIR: "$CI_PROJECT_DIR/dist"
NPM_PACKAGE_SCOPE: "@hiveio"
NPM_PACKAGE_NAME: "workerbee"
artifacts:
paths:
- "${DIST_DIR}/*.tgz"
- "${DIST_DIR}/bundle/web-full.*"
when: always
expire_in: 1 week
needs:
- job: lint
generate_docs:
stage: build
extends: .npm_process_built_package_tarball
variables:
DIST_DIR: "$CI_PROJECT_DIR/dist"
PACKAGE_TGZ_PATH: "${BUILT_PACKAGE_PATH}"
script:
- scripts/generate_api_docs.sh "${CI_PROJECT_URL}" "${CI_COMMIT_SHA}"
needs:
- job: build
artifacts: true
artifacts:
paths:
- "${DIST_DIR}/docs"
when: always
expire_in: 1 week
test:
stage: test
extends: .npm_test_template
variables:
PACKAGE_TGZ_PATH: "${BUILT_PACKAGE_PATH}"
needs:
- job: build
artifacts: true
push_to_wiki:
extends: .npm_push_doc_template
stage: deploy
variables:
WIKI_PUSH_TOKEN: "$WIKI_PUSH_TOKEN"
DIST_DIR: "$CI_PROJECT_DIR/dist"
needs:
- job: generate_docs
artifacts: true
supplement_documentation_url:
extends: .npm_process_built_package_tarball
stage: deploy
needs:
- job: build
artifacts: true
- job: push_to_wiki
artifacts: true
variables:
PACKAGE_TGZ_PATH: "${BUILT_PACKAGE_PATH}"
DIST_DIR: "$CI_PROJECT_DIR/dist"
script:
- |
scripts/generate_api_docs.sh "${CI_PROJECT_URL}" "${CI_COMMIT_SHA}" "${GEN_DOC_URL}" tmp_doc
npm pack --pack-destination "${DIST_DIR}" --json > "${DIST_DIR}/built_package_info.json" # repack to include updated README in final package
BUILT_PACKAGE_NAME=$(jq -r .[].filename "${DIST_DIR}/built_package_info.json")
echo BUILT_PACKAGE_PATH="${DIST_DIR}/${BUILT_PACKAGE_NAME}" > built_package_info.env
artifacts:
reports:
dotenv:
- "${SOURCE_DIR}/built_package_info.env" # contains path to produced tgz
paths:
- "${DIST_DIR}/*.tgz" # Built package
when: always
expire_in: 1 week
deploy_dev_package:
stage: deploy
extends: .npm_deploy_package_template
variables:
PACKAGE_TGZ_PATH: "${BUILT_PACKAGE_PATH}"
NPM_PACKAGE_SCOPE: "@hiveio"
needs:
- job: lint
- job: test
- job: supplement_documentation_url
artifacts: true
deploy_production_public_npm:
stage: deploy
extends: .registry_npmjs_org_deploy_package_template
id_tokens:
SIGSTORE_ID_TOKEN:
aud: sigstore
variables:
NPM_PUBLISH_TOKEN: "$INTERNAL_HIDDEN_PUBLISH_TOKEN"
NPM_PACKAGE_NAME: "workerbee"
NPM_PROVENANCE_ENABLE: "0" # XXX: Temporarly disable as it is not working - we have to find a way to get it working
PACKAGE_TGZ_PATH: "${BUILT_PACKAGE_PATH}"
needs:
- job: lint
- job: test
- job: supplement_documentation_url
artifacts: true