-
Notifications
You must be signed in to change notification settings - Fork 78
/
Copy pathJenkinsfile
79 lines (65 loc) · 2.04 KB
/
Jenkinsfile
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
node('linux && docker') {
checkout scm
def tag = env.TAG_NAME
withEnv([
'npm_config_cache=npm-cache'
]){
withDockerContainer(image: 'nikolaik/python-nodejs:python3.11-nodejs18', args: '-u=root') {
stage('Install') {
// Prevents "not a git directory" issue.
sh "git config --global --add safe.directory '*'"
sh 'npm i -g npm@latest'
sh 'npm install'
}
stage('Build') {
sh 'npm run injectVersion'
sh 'npm run build'
sh 'npm run minimize'
}
stage('Install Chrome') {
sh "wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -"
sh "echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list"
sh "apt-get update"
sh "apt-get install -y google-chrome-stable"
sh "google-chrome --version"
}
stage('Test') {
sh 'npm run unitTests'
if (tag) {
sh 'npm run accessibilityTests'
}
sh 'set +e'
// sh 'npm run uploadCoverage'
sh 'set -e'
sh 'npm run validateTypeDefinitions'
}
if (!tag) {
return
}
stage('Docs') {
withCredentials([
usernameColonPassword(credentialsId: 'github-commit-token', variable: 'GITHUB_TOKEN')
]) {
sh './deploy.doc.sh'
}
sh 'npm run docsitemap'
}
stage('Github Release') {
sh 'npm run zipForGitReleases'
withCredentials([
usernamePassword(credentialsId: 'github-commit-token', usernameVariable: 'GITHUB_USERNAME', passwordVariable: 'GITHUB_TOKEN')
]) {
sh 'node ./build/github-release.deploy.js'
}
}
stage('Deploy') {
withCredentials([
string(credentialsId: 'NPM_TOKEN', variable: 'NPM_TOKEN')
]) {
sh 'node ./build/npm.deploy.js'
}
sh 'node ./build/deployment-pipeline.deploy.js || true'
}
}
}
}