-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
51 lines (44 loc) · 993 Bytes
/
.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
image: eclipse-temurin:21-alpine
before_script:
- chmod +x gradlew
- ./gradlew --refresh-dependencies
cache:
paths:
- .gradle/wrapper
- .gradle/cache
- .m2
stages:
- build
- package
build:
stage: build
script:
- ./gradlew bootJar
artifacts:
paths:
- ./build/libs/*.jar
expire_in: 2 day
docker-build:
image: docker:latest
stage: package
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- |
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
tag=""
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
else
tag=":$CI_COMMIT_REF_SLUG"
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
fi
- docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- docker push "$CI_REGISTRY_IMAGE${tag}"
dependencies:
- build
only:
- master
- homolog
- dev