Skip to content

Commit

Permalink
Issue #11726: Automate creation of settings.xml file for release
Browse files Browse the repository at this point in the history
  • Loading branch information
Rahulkhinchi03 authored and romani committed Jun 26, 2022
1 parent caa1951 commit c666b0e
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .ci/jsoref-spellchecker/whitelist.words
Expand Up @@ -230,6 +230,7 @@ Cloneable
cloudbees
clss
cmdline
cmp
cmt
CNAME
Cnt
Expand Down Expand Up @@ -752,6 +753,7 @@ kbd
kclee
KDoc
keygen
keyname
keyrings
Kochurkin
konstantinos
Expand Down Expand Up @@ -1036,6 +1038,7 @@ parenpad
parrt
parsetreetablepresentation
Passembly
passphrase
pathcomplexity
patreon
patternvariablename
Expand Down
38 changes: 38 additions & 0 deletions .ci/prepare-settings.sh
@@ -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
24 changes: 24 additions & 0 deletions .ci/release-settings.xml
@@ -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>

0 comments on commit c666b0e

Please sign in to comment.