-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
53 lines (45 loc) · 1.7 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
image: maven:3-jdk-8
variables:
CI_PROJECT_PATH: "ReightI/test-nucleusj-ci-cd"
API_IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
VERSION: "2.0.1"
stages:
- compile
- deploy
- release
# ------------------------- Compile ----------------------------------------
# Compile the Maven project with all it's dependencies thanks to maven-assembly-plugin.
compile:
stage: compile
except:
- tags
script:
- mvn versions:set -DnewVersion=$VERSION
- mvn clean package
artifacts:
paths:
- target
# ------------------------- Deploy ----------------------------------------
# Deploy the Maven artifacts generated by "Compile" stage to Gitlab Maven repository.
deploy:
stage: deploy
only:
- master
except:
- tags
script:
- mvn deploy:deploy-file -Durl=https://gitlab.com/api/v4/projects/19044962/packages/maven/ -DrepositoryId=gitlab-maven -Dfile=target/NucleusJ_2-$VERSION.jar -DgroupId=burp -DartifactId=NucleusJ_2 -Dversion=$VERSION -Dpackaging=jar -DgeneratePom=false -DuniqueVersion=true -s ci_settings.xml
dependencies:
- compile
# ------------------------- Release ----------------------------------------
# Do a gitlab release with "release-cli" tool.
# Assets are a JAR file deployed at https://gitlab.com/api/v4/projects/19044962/packages/maven
release_branch:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
except:
- tags
only:
- master
script:
- release-cli create --name "v$VERSION" --description "new release" --tag-name "v$VERSION" --ref $CI_COMMIT_SHA --assets-links-name ".jar" --assets-links-url "https://gitlab.com/api/v4/projects/19044962/packages/maven/burp/NucleusJ_2/$VERSION/NucleusJ_2-$VERSION.jar"