-
Notifications
You must be signed in to change notification settings - Fork 13
/
.gitlab-ci.yml
66 lines (60 loc) · 2.1 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
image: dockerhub.dsi.tecnico.ulisboa.pt/fenix-framework/docker/java-fenix-framework:jdk8
cache:
paths:
- .m2/repository/
- target/
stages:
- Install and Lint
# - Test
- Release
- Notify
Install and Lint:
stage: Install and Lint
before_script:
- cp -R /opt/config_m2 ./.m2
- export MAVEN_REPO_USER=$NEXUS_USERNAME
- export MAVEN_REPO_PASS=$NEXUS_PASSWORD
- export MAVEN_REPO_ID=dsi-maven-artifacts
script:
- mvn -s .m2/settings.xml clean install -Dmaven.test.skip=true
# Test:
# stage: Test
# script:
# - mvn test
Release:
stage: Release
before_script:
- cp -R /opt/config_m2 ./.m2
- export MAVEN_REPO_USER=$NEXUS_USERNAME
- export MAVEN_REPO_PASS=$NEXUS_PASSWORD
- export MAVEN_REPO_ID=dsi-maven-artifacts
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@repo.dsi.tecnico.ulisboa.pt/tools/release-army-knife.git
- cd release-army-knife
- npm install
- cd ..
- mvn help:evaluate
- VERSION=$(echo '${project.version}' | mvn help:evaluate | grep -v '^[[]')
- if [[ v$VERSION != $CI_COMMIT_TAG ]]; then echo "Version v$VERSION in pom.xml diferent from $CI_COMMIT_TAG tag" && exit 1; fi
script:
- mvn -s .m2/settings.xml --batch-mode deploy -Dmaven.test.skip=true
- node release-army-knife/release.js $CI_PROJECT_ID $CI_COMMIT_TAG $REPO_API_ACCESS_TOKEN
only:
- tags
Notify:
stage: Notify
before_script:
- cp -R /opt/config_m2 ./.m2
- export MAVEN_REPO_USER=$NEXUS_USERNAME
- export MAVEN_REPO_PASS=$NEXUS_PASSWORD
- export MAVEN_REPO_ID=dsi-maven-artifacts
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@repo.dsi.tecnico.ulisboa.pt/tools/release-army-knife.git
- cd release-army-knife
- npm install
- cd ..
- mvn help:evaluate
- VERSION=$(echo '${project.version}' | mvn help:evaluate | grep -v '^[[]')
- if [[ v$VERSION != $CI_COMMIT_TAG ]]; then echo "Version v$VERSION in pom.xml diferent from $CI_COMMIT_TAG tag" && exit 1; fi
script:
- node release-army-knife/notify-mattermost.js $CI_PROJECT_ID $CI_COMMIT_TAG $REPO_API_ACCESS_TOKEN $CHAT_HOOK
only:
- tags