add releases to ci
This commit is contained in:
parent
73ec38f576
commit
3ba5964cd1
2 changed files with 52 additions and 2 deletions
|
@ -4,17 +4,24 @@ stages:
|
||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
- publish
|
- publish
|
||||||
|
- fatjar
|
||||||
|
- release
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- echo "---------- Start CI ----------"
|
- echo "---------- Start CI ----------"
|
||||||
- export GRADLE_USER_HOME=`pwd`/.gradle
|
- export GRADLE_USER_HOME=`pwd`/.gradle
|
||||||
- chmod +x gradlew
|
- chmod +x gradlew
|
||||||
|
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- .gradle/wrapper
|
||||||
|
- .gradle/caches
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- echo "---------- build stage ----------"
|
- echo "---------- build stage ----------"
|
||||||
- ./gradlew --build-cache assemble
|
- ./gradlew assemble
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- build/libs/*.jar
|
- build/libs/*.jar
|
||||||
|
@ -22,6 +29,8 @@ build:
|
||||||
|
|
||||||
test:
|
test:
|
||||||
stage: test
|
stage: test
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG == null # don't run for git tags
|
||||||
image: docker:latest
|
image: docker:latest
|
||||||
services:
|
services:
|
||||||
- docker:dind
|
- docker:dind
|
||||||
|
@ -45,6 +54,7 @@ test:
|
||||||
reports:
|
reports:
|
||||||
junit: build/test-results/test/TEST-*.xml
|
junit: build/test-results/test/TEST-*.xml
|
||||||
|
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
stage: publish
|
stage: publish
|
||||||
script:
|
script:
|
||||||
|
@ -55,5 +65,45 @@ publish:
|
||||||
- build/libs/*.jar
|
- build/libs/*.jar
|
||||||
expire_in: 2 months
|
expire_in: 2 months
|
||||||
|
|
||||||
|
|
||||||
|
fatjar:
|
||||||
|
stage: fatjar
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
before_script:
|
||||||
|
- echo $CI_JOB_ID
|
||||||
|
# Writing FATJAR_JOB_ID variable to environment file, as variable is needed in the release stage.
|
||||||
|
- echo FATJAR_JOB_ID=$CI_JOB_ID >> generate_executables.env
|
||||||
|
script:
|
||||||
|
- echo "---------- create fatjar ----------"
|
||||||
|
- ./gradlew fatJarLatest
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- 'build/libs/provs-fatjar.jar'
|
||||||
|
reports:
|
||||||
|
# To ensure we've access to this file in the next stage
|
||||||
|
dotenv: generate_executables.env
|
||||||
|
expire_in: 6 months
|
||||||
|
|
||||||
|
|
||||||
|
release:
|
||||||
|
stage: release
|
||||||
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG # Run this job when a git tag is created manually
|
||||||
|
script:
|
||||||
|
- echo '------------ creating a release -------------'
|
||||||
|
- echo 'Fatjar Job ID:'
|
||||||
|
- echo $FATJAR_JOB_ID
|
||||||
|
release:
|
||||||
|
name: 'Release $CI_COMMIT_TAG'
|
||||||
|
description: 'Release of provs'
|
||||||
|
tag_name: '$CI_COMMIT_TAG'
|
||||||
|
ref: '$CI_COMMIT_TAG'
|
||||||
|
assets:
|
||||||
|
links:
|
||||||
|
- name: provs-fatjar.jar
|
||||||
|
url: https://gitlab.com/domaindrivenarchitecture/provs/-/jobs/${FATJAR_JOB_ID}/artifacts/raw/build/libs/provs-fatjar.jar
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
- echo "---------- End CI ----------"
|
- echo "---------- End CI ----------"
|
||||||
|
|
|
@ -111,7 +111,7 @@ task fatJarLatest(type: Jar) {
|
||||||
'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliKt'
|
'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliKt'
|
||||||
}
|
}
|
||||||
with jar
|
with jar
|
||||||
archiveFileName = 'provs-fat-latest.jar'
|
archiveFileName = 'provs-fatjar.jar'
|
||||||
}
|
}
|
||||||
|
|
||||||
task uberjarWorkplace(type: Jar) {
|
task uberjarWorkplace(type: Jar) {
|
||||||
|
|
Loading…
Reference in a new issue