Modified gitlab-ci again and added a stage

Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
Louis Vallat 2020-10-29 21:05:16 +01:00
parent 257d409860
commit f833bb7d5b

View File

@ -5,6 +5,7 @@ services:
stages:
- build
- test
- package
- release
# Disable the Gradle daemon for Continuous Integration servers as correctness
@ -25,7 +26,7 @@ before_script:
build:
image: gradle:jdk15
stage: build
script: gradle --build-cache assemble
script: gradle --build-cache buildJava
cache:
key: "$CI_COMMIT_REF_NAME"
policy: push
@ -37,26 +38,40 @@ build:
test:
image: gradle:jdk15
stage: test
script: gradle check
script: gradle --build-cache check
cache:
key: "$CI_COMMIT_REF_NAME"
policy: pull
paths:
- build/libs/*.jar
- build
- .gradle
release-image-test:
package:
image: gradle:jdk15
stage: package
script: gradle --build-cache assemble
cache:
key: "$CI_COMMIT_REF_NAME"
policy: push
paths:
- build
- .gradle
artifacts:
paths:
- build/libs/*.jar
release:
stage: release
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build . -t $CONTAINER_BRANCH_IMAGE
- docker push $CONTAINER_BRANCH_IMAGE
release-image:
release-master:
stage: release
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build . -t $CONTAINER_BRANCH_IMAGE -t $CONTAINER_RELEASE_IMAGE
- docker push $CONTAINER_RELEASE_IMAGE $CONTAINER_BRANCH_IMAGE
- docker build . -t $CONTAINER_RELEASE_IMAGE
- docker push $CONTAINER_RELEASE_IMAGE
only:
- master