Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #11726: Automate creation of settings.xml file for release
- Loading branch information
1 parent
caa1951
commit c666b0e
Showing
3 changed files
with
65 additions
and
0 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
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,38 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
mkdir -p .ci-temp | ||
cp .ci/release-settings.xml .ci-temp/ | ||
|
||
checkForVariable() { | ||
VAR_NAME=$1 | ||
if [ -v "${!VAR_NAME}" ]; then | ||
echo "Error: Define $1 environment variable" | ||
exit 1 | ||
fi | ||
} | ||
|
||
checkForVariable "SONATYPE_USER" | ||
checkForVariable "SONATYPE_PWD" | ||
checkForVariable "GPG_PASSPHRASE" | ||
checkForVariable "GPG_KEY" | ||
|
||
replace() { | ||
sed -i "s/$1/$2/g" .ci-temp/release-settings.xml | ||
} | ||
|
||
replace SONATYPE_USER | ||
replace SONATYPE_PWD | ||
replace GPG_PASSPHRASE | ||
replace GPG_KEY | ||
|
||
|
||
TEMP_SETTING="./.ci-temp/release-settings.xml" | ||
SETTING="~/.m2/settings.xml" | ||
|
||
if cmp -s "$TEMP_SETTING" "$SETTING"; then | ||
TODAY=$(date + "%y%m%d") | ||
mv $SETTING $SETTING.backup."${TODAY}" | ||
fi | ||
|
||
cp $TEMP_SETTING $SETTING |
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,24 @@ | ||
<settings> | ||
<servers> | ||
<server> | ||
<id>sonatype-nexus-staging</id> | ||
<username>SONATYPE_USER</username> | ||
<password>SONATYPE_PWD</password> | ||
</server> | ||
</servers> | ||
|
||
<profiles> | ||
<profile> | ||
<!-- "mvn release:prepare .... -Pgpg" | ||
and it is possible to skip " -Dgpg.passphrase=...." at "-Darguments" | ||
Use "gpg \-\-list-keys", "pub 1024D/C6XXXX57A 2010-01-13" | ||
to get "gpg.keyname" in example it is value "C6XXXX57A" | ||
--> | ||
<id>gpg</id> | ||
<properties> | ||
<gpg.passphrase>GPG_PASSPHRASE</gpg.passphrase> | ||
<gpg.keyname>GPG_KEY</gpg.keyname> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
</settings> |