Commit e591cdfe authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets Committed by Achilleas Pipinellis

Add instructions how setup automatic maven package deploy via CI

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 745eebda
......@@ -52,4 +52,44 @@ You can add a corresponding section to your `settings.xml` file:
</settings>
```
## Create maven packages with GitLab CI
Once you have your repository configured to use GitLab Maven Packages repository,
you can configure GitLab CI to build new packages automatically. The example below
shows you how to create a new package each time the master branch is updated.
1\. Create a `ci_settings.xml` file specially for GitLab CI and put it into your repository.
```xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<servers>
<server>
<id>gitlab-maven</id>
<configuration>
<httpHeaders>
<property>
<name>Job-Token</name>
<value>CI_JOB_TOKEN</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>
```
2\. Add `deploy` section to your `.gitlab-ci.yml` file.
```
deploy:
script:
- 'cp ci_settings.xml /root/.m2/settings.xml'
- 'sed -i "s/CI_JOB_TOKEN/${CI_JOB_TOKEN}/g" /root/.m2/settings.xml'
- 'mvn deploy'
only:
- master
image: maven:3.3.9-jdk-8
```
[pat]: ../profile/personal_access_tokens.md
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment