Skip to content

Commit

Permalink
refactor: gitlab ci
Browse files Browse the repository at this point in the history
1. 设置个性化settings.xml
2. 设置maven仓库缓存
  • Loading branch information
sunhao-java committed Jun 7, 2024
1 parent 1a58700 commit b656124
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
17 changes: 14 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,25 @@
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
variables:
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
MAVEN_SETTINGS_XML: "$CI_PROJECT_DIR/.m2/settings.xml"

stages: # List of stages for jobs, and their order of execution
cache:
paths:
- .m2/repository

stages: # List of stages for jobs, and their order of execution
- deploy

deploy-job: # This job runs in the build stage, which runs first.
before_script:
- mkdir -p $CI_PROJECT_DIR/.m2
- cp $CI_PROJECT_DIR/.mvn/settings.xml $MAVEN_SETTINGS_XML

deploy-job: # This job runs in the build stage, which runs first.
stage: deploy
tags:
- centos
script:
- echo "Start deploy lodsve-boot to lodsve nexus repository..."
- ./lodsve deployLodsve
- ./mvnw clean deploy -P release-oss -s $MAVEN_SETTINGS_XML -Dmaven.test.skip=true
30 changes: 30 additions & 0 deletions .mvn/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups></pluginGroups>

<mirrors>
<mirror>
<id>mirror-all</id>
<mirrorOf>*</mirrorOf>
<name>mirror</name>
<url>${env.LODSVE_REPO_PREFIX}/repository/maven-public/</url>
</mirror>
</mirrors>

<profiles>
<profile>
<id>release-lodsve</id>
<properties>
<lodsve.snapshots.repository.url>${env.LODSVE_REPO_PREFIX}/repository/lodsve-snapshot/
</lodsve.snapshots.repository.url>
<lodsve.releases.repository.url>${env.LODSVE_REPO_PREFIX}/repository/lodsve-release/
</lodsve.releases.repository.url>
</properties>
</profile>
</profiles>

<activeProfiles>
</activeProfiles>
</settings>

0 comments on commit b656124

Please sign in to comment.