Skip to content

Commit f501158

Browse files
committed
release ready
1 parent c21fb30 commit f501158

File tree

5 files changed

+69
-8
lines changed

5 files changed

+69
-8
lines changed

.ci/deploy.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,9 @@ if [ -z "$1" ]; then
2828
exit 1
2929
fi
3030

31-
mvn clean deploy -P"$1" --settings "${TRAVIS_BUILD_DIR}"/.mvn/settings.xml -Dgpg.executable=gpg2 -Dgpg.keyname="$GPG_KEY_NAME"-Dgpg.passphrase="$GPG_PASSPHRASE"
31+
version=$(mvn exec:exec -q -N -Dexec.executable="echo" -Dexec.args='${project.version}' | awk -F '-' '{print $2}')
32+
echo "${version}"
33+
34+
if [ "$version" ]; then
35+
mvn clean deploy -Psnapshot --settings "${TRAVIS_BUILD_DIR}"/.mvn/settings.xml -Dgpg.executable=gpg2 -Dgpg.keyname="$GPG_KEY_NAME"-Dgpg.passphrase="$GPG_PASSPHRASE"
36+
fi

.ci/release.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Check the variables are set
6+
if [ -z "$SONATYPE_USERNAME" ]; then
7+
echo "missing environment value: SONATYPE_USERNAME" >&2
8+
exit 1
9+
fi
10+
11+
if [ -z "$SONATYPE_PASSWORD" ]; then
12+
echo "missing environment value: SONATYPE_PASSWORD" >&2
13+
exit 1
14+
fi
15+
16+
if [ -z "$GPG_KEY_NAME" ]; then
17+
echo "missing environment value: GPG_KEY_NAME" >&2
18+
exit 1
19+
fi
20+
21+
if [ -z "$GPG_PASSPHRASE" ]; then
22+
echo "missing environment value: GPG_PASSPHRASE" >&2
23+
exit 1
24+
fi
25+
26+
if [ -z "$1" ]; then
27+
echo "missing environment value: Maven BUILD PROFILE" >&2
28+
exit 1
29+
fi
30+
31+
if [ "$TRAVIS_TAG" ]; then
32+
mvn clean deploy -Prelease --settings "${TRAVIS_BUILD_DIR}"/.mvn/settings.xml -Dgpg.executable=gpg2 -Dgpg.keyname="$GPG_KEY_NAME"-Dgpg.passphrase="$GPG_PASSPHRASE"
33+
else
34+
echo "not create a tag"
35+
fi
36+
37+

.mvn/settings.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@
2121
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
2222
<servers>
2323
<server>
24-
<id>sonatype</id>
24+
<id>sonatype-snapshot</id>
25+
<username>${env.SONATYPE_USERNAME}</username>
26+
<password>${env.SONATYPE_PASSWORD}</password>
27+
</server>
28+
<server>
29+
<id>sonatype-release</id>
2530
<username>${env.SONATYPE_USERNAME}</username>
2631
<password>${env.SONATYPE_PASSWORD}</password>
2732
</server>

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ notifications:
44
email:
55
recipients:
66
7+
78
on_success: change
89
on_failure: always
910

@@ -30,12 +31,12 @@ before_install:
3031
deploy:
3132
- skip_cleanup: true
3233
provider: script
33-
script: bash .ci/deploy.sh snapshot
34+
script: bash .ci/deploy.sh
3435
on:
3536
branch: master
3637
- skip_cleanup: true
3738
provider: script
38-
script: bash .ci/deploy.sh release
39+
script: bash .ci/release.sh
3940
on:
4041
tags: true
4142

pom.xml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,20 @@
500500
<skip>true</skip>
501501
</configuration>
502502
</plugin>
503+
<plugin>
504+
<groupId>org.apache.maven.plugins</groupId>
505+
<artifactId>maven-gpg-plugin</artifactId>
506+
<version>1.6</version>
507+
<executions>
508+
<execution>
509+
<id>sign-artifacts</id>
510+
<phase>verify</phase>
511+
<goals>
512+
<goal>sign</goal>
513+
</goals>
514+
</execution>
515+
</executions>
516+
</plugin>
503517
<plugin>
504518
<groupId>org.sonatype.plugins</groupId>
505519
<artifactId>nexus-staging-maven-plugin</artifactId>
@@ -509,12 +523,11 @@
509523
<phase>deploy</phase>
510524
<goals>
511525
<goal>deploy</goal>
512-
<goal>release</goal>
513526
</goals>
514527
</execution>
515528
</executions>
516529
<configuration>
517-
<serverId>sonatype</serverId>
530+
<serverId>sonatype-release</serverId>
518531
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
519532
</configuration>
520533
</plugin>
@@ -526,12 +539,12 @@
526539
<distributionManagement>
527540
<!--ID must exist in file .m2/setting.xml. server ID-->
528541
<snapshotRepository>
529-
<id>sonatype</id>
542+
<id>sonatype-snapshot</id>
530543
<name>Nexus Snapshot Repository</name>
531544
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
532545
</snapshotRepository>
533546
<repository>
534-
<id>sonatype</id>
547+
<id>sonatype-release</id>
535548
<name>Nexus Release Repository</name>
536549
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
537550
</repository>

0 commit comments

Comments
 (0)