-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJenkinsfile
More file actions
70 lines (64 loc) · 1.94 KB
/
Copy pathJenkinsfile
File metadata and controls
70 lines (64 loc) · 1.94 KB
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
#!/usr/bin/env groovy
pipeline {
agent any
environment {
NPM_TOKEN = credentials('npm-token')
TIPTAP_PRO_TOKEN = credentials('tiptap-pro-token')
NPM_PUBLIC_TOKEN = credentials('npm-public-token')
}
stages {
stage("Initialization") {
steps {
script {
sh './build.sh init'
def version = sh(returnStdout: true, script: 'docker run --rm -u `id -u`:`id -g` --env MAVEN_CONFIG=/var/maven/.m2 -w /usr/src/maven -v ./backend/:/usr/src/maven -v ~/.m2:/var/maven/.m2 opendigitaleducation/mvn-java8-node20:latest mvn -Duser.home=/var/maven help:evaluate -Dexpression=project.version -DforceStdout -q')
buildName "${env.GIT_BRANCH.replace("origin/", "")}@${version}"
}
}
}
stage('Frontend') {
steps {
dir('frontend') {
sh './build.sh clean init build'
}
}
}
stage('Backend') {
steps {
dir('backend') {
sh 'mkdir -p ./src/main/resources/public/ || TRUE'
sh 'find ./src/main/resources/public/ -maxdepth 1 -type f -exec rm -f {} +'
sh 'cp -R ../frontend/dist/* ./src/main/resources/'
sh 'rm -f ./src/main/resources/package.json'
sh 'mv ./src/main/resources/*.html ./src/main/resources/view'
sh './build.sh init clean build publish'
sh 'rm -rf ../frontend/dist'
}
}
}
stage('Build image') {
steps {
sh './edifice image --archs=linux/amd64 --force --rebuild=false'
}
}
stage('Publish NPM Wiki App package') {
when {
expression {
return env.DRY_RUN != 'true'
}
}
steps {
withEnv(["NPM_TOKEN=${env.NPM_PUBLIC_TOKEN}"]) {
script {
sh 'cd frontend && ./build.sh publishNPM'
}
}
}
}
}
post {
cleanup {
sh 'cd backend && (docker-compose down || true) && cd ../frontend && (docker-compose down || true)'
}
}
}