-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- added automated SNAPSHOT publishing to Maven Central repository
- Loading branch information
Showing
3 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<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"> | ||
<servers> | ||
<server> | ||
<!-- Maven Central Deployment --> | ||
<id>ossrh</id> | ||
<username>${env.SONATYPE_USERNAME}</username> | ||
<password>${env.SONATYPE_PASSWORD}</password> | ||
</server> | ||
</servers> | ||
|
||
<profiles> | ||
<profile> | ||
<id>ossrh</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<properties> | ||
<gpg.executable>${env.GPG_EXECUTABLE}</gpg.executable> | ||
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
</settings> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
#Parse project version from pom.xml | ||
export PROJECT_VERSION=`xmllint --xpath "//*[local-name()='project']/*[local-name()='version']/text()" pom.xml` | ||
echo "Project version: $PROJECT_VERSION" | ||
|
||
#Skip if not *SNAPSHOT | ||
if [[ $PROJECT_VERSION != *SNAPSHOT ]]; then | ||
echo "$PROJECT_VERSION is not SNAPSHOT - skip deploy."; | ||
exit; | ||
fi | ||
|
||
|
||
DEFAULT_MAVEN_JAVA_VERSION="3-jdk-8-slim" | ||
MAVEN_JAVA_VERSION="${MAVEN_JAVA_VERSION:-$DEFAULT_MAVEN_JAVA_VERSION}" | ||
echo "Deploy snapshot with maven:${MAVEN_JAVA_VERSION}" | ||
|
||
docker run -it --rm \ | ||
--volume ${PWD}:/usr/src/mymaven \ | ||
--volume ${PWD}/.m2:/root/.m2 \ | ||
--workdir /usr/src/mymaven \ | ||
--env SONATYPE_USERNAME=${SONATYPE_USERNAME} \ | ||
--env SONATYPE_PASSWORD=${SONATYPE_PASSWORD} \ | ||
maven:${MAVEN_JAVA_VERSION} mvn -s .maven-settings.xml -DskipTests=true clean package deploy |