-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
55 lines (52 loc) · 1.58 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
# 1) Initiates build for every "master" or "tags" push
maven-build:
stage: build
script:
- mvn clean install
artifacts:
paths:
- target/*.jar
name: ${CI_PROJECT_NAME}-${CI_COMMIT_SHORT_SHA}
cache:
paths:
- node_modules/
only:
- master
- tags
# 2) Copies build to both, download/ci/ and dmx-dev-container
copy-to-ci:
stage: deploy
script:
- CIDIR='/var/www/download.dmx.systems/ci'
- DESTDIR="${CIDIR}/${CI_PROJECT_NAME}"
- JARFILE="$(basename $(ls target/*.jar | tail -n1))"
- NUNC="$(date +%F)"
- DESTJARFILE="$(basename ${JARFILE} .jar)_${NUNC}_${CI_PIPELINE_ID}.jar"
- if [ ! -d ${DESTDIR} ]; then mkdir ${DESTDIR}; fi
- cp target/${JARFILE} ${DESTDIR}/${DESTJARFILE}
- ln -sf ${DESTDIR}/${DESTJARFILE} ${DESTDIR}/${CI_PROJECT_NAME}-latest.jar
- docker exec dmx-dev-container sh -c "rm -f /usr/share/dmx/bundle-deploy/${CI_PROJECT_NAME}-*.jar"
- docker cp ${DESTDIR}/${DESTJARFILE} dmx-dev-container:/usr/share/dmx/bundle-deploy/
dependencies:
- maven-build
only:
- master
# 3) Copies tagged (release) builds to download/plugins/
copy-to-release:
stage: deploy
script:
- RELEASEDIR='/var/www/download.dmx.systems/plugins'
- DESTDIR="${RELEASEDIR}/${CI_PROJECT_NAME}"
- JARFILE="$(basename $(ls target/*.jar | tail -n1))"
- if [ ! -d ${DESTDIR} ]; then mkdir ${DESTDIR}; fi
- cp target/${JARFILE} ${DESTDIR}/
dependencies:
- maven-build
only:
- tags
# 4) Triggers another project
trigger-project:
stage: deploy
trigger: dmx-projects/zukunftswerk
only:
- master