-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathJenkinsfile
More file actions
52 lines (48 loc) · 1.5 KB
/
Copy pathJenkinsfile
File metadata and controls
52 lines (48 loc) · 1.5 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
#!/usr/bin/env groovy
pipeline {
agent any
environment {
NPM_TOKEN = credentials('npm-token')
TIPTAP_PRO_TOKEN = credentials('tiptap-pro-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 '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 --rebuild=false'
}
}
}
post {
cleanup {
sh 'cd backend && (docker-compose down || true) && cd ../frontend && (docker-compose down || true)'
}
}
}