Using help plugin for config retrieval
diff --git a/deploySite.sh b/deploySite.sh
index 5c98e75..3cc7ff9 100755
--- a/deploySite.sh
+++ b/deploySite.sh
@@ -26,22 +26,15 @@
THIS_DIR=$(dirname $0)
THIS_DIR=$(readlink -f ${THIS_DIR})
-CONTENT_DIR=".site-content"
-BRANCH="asf-staging-3.0"
-SUB_DIR="/components"
-if grep -q '<scmPublishBranch>' pom.xml; then
- BRANCH=$(sed -n -e 's/.*<scmPublishBranch>\(.*\)<\/scmPublishBranch>.*/\1/p' pom.xml)
-fi
-
-if grep -q '<scmPubCheckoutDirectory>' pom.xml; then
- CONTENT_DIR=$(sed -n -e 's/.*<scmPubCheckoutDirectory>\(.*\)<\/scmPubCheckoutDirectory>.*/\1/p' pom.xml)
-fi
-
-
+VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
+PUBLISH_PATH=$(mvn help:evaluate -Dexpression=scmPublishPath -q -DforceStdout)
+BRANCH=$(mvn help:evaluate -Dexpression=scmPublishBranch -q -DforceStdout)
+CONTENT_DIR=$(mvn help:evaluate -Dexpression=scmPubCheckoutDirectory -q -DforceStdout)
if [ -d "${CONTENT_DIR}/.git" ]; then
git -C "${CONTENT_DIR}" fetch origin
+ git -C "${CONTENT_DIR}" checkout ${BRANCH}
git -C "${CONTENT_DIR}" reset --hard origin/${BRANCH}
git -C "${CONTENT_DIR}" clean -f -d
fi
@@ -53,7 +46,7 @@
echo "*****************************************"
echo ">>>> Finished the site stage process <<<<"
echo "> You can check the content in the folder target/staging or by opening the following url"
-echo "> file://${THIS_DIR}/target/staging${SUB_DIR}/index.html"
+echo "> file://${THIS_DIR}/target/staging${PUBLISH_PATH}/index.html"
echo "> "
echo "> If everything is fine enter yes. After that the publish process will be started."
echo -n "Do you want to publish (yes/no)? "
diff --git a/pom.xml b/pom.xml
index e23e7ea..972468c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -53,14 +53,15 @@
<site.staging.base>${project.basedir}/target/staging/components</site.staging.base>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<webUrl>https://archiva.apache.org/components</webUrl>
- <scmPubCheckoutDirectory>${basedir}/.site-content</scmPubCheckoutDirectory>
+
<!-- The git repository, where the site content is placed -->
<siteRepositoryUrl>scm:git:https://gitbox.apache.org/repos/asf/archiva-web-content.git</siteRepositoryUrl>
<site.staging.base>${project.basedir}</site.staging.base>
- <asciidoctor.maven.plugin.version>2.0.0-RC.1</asciidoctor.maven.plugin.version>
-
+ <scmPubCheckoutDirectory>.site-content</scmPubCheckoutDirectory>
<scmPublishBranch>asf-staging</scmPublishBranch>
+ <scmPublishPath>/components</scmPublishPath>
+
</properties>
<description>Parent Pom for various components used in Apache Archiva and Redback.</description>
@@ -396,7 +397,7 @@
<inputEncoding>UTF-8</inputEncoding>
<outputEncoding>UTF-8</outputEncoding>
<skipDeploy>true</skipDeploy>
- <stagingDirectory>${site.staging.base}/target/staging/components</stagingDirectory>
+ <stagingDirectory>${site.staging.base}/target/staging${scmPublishPath}</stagingDirectory>
<asciidoc>
<!-- optional site-wide AsciiDoc attributes -->
<attributes>