Using help plugin for config retrieval

This commit is contained in:
Martin Stockhammer 2019-12-01 00:04:09 +01:00
parent e81b8c5cb6
commit 011aed509e
3 changed files with 8 additions and 17 deletions

View File

@ -26,23 +26,13 @@
THIS_DIR=$(dirname $0) THIS_DIR=$(dirname $0)
THIS_DIR=$(readlink -f ${THIS_DIR}) THIS_DIR=$(readlink -f ${THIS_DIR})
CONTENT_DIR=".site-content"
BRANCH="asf-staging-3.0"
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
PUBLISH_PATH=$(mvn help:evaluate -Dexpression=scmPublishPath -q -DforceStdout)
SUB_DIR="/redback/core/${VERSION}" BRANCH=$(mvn help:evaluate -Dexpression=scmPublishBranch -q -DforceStdout)
CONTENT_DIR=$(mvn help:evaluate -Dexpression=scmPubCheckoutDirectory -q -DforceStdout)
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
if [ -d "${CONTENT_DIR}/.git" ]; then if [ -d "${CONTENT_DIR}/.git" ]; then
git -C "${CONTENT_DIR}" fetch origin
git -C "${CONTENT_DIR}" fetch origin git -C "${CONTENT_DIR}" fetch origin
git -C "${CONTENT_DIR}" reset --hard origin/${BRANCH} git -C "${CONTENT_DIR}" reset --hard origin/${BRANCH}
git -C "${CONTENT_DIR}" clean -f -d git -C "${CONTENT_DIR}" clean -f -d
@ -55,7 +45,7 @@ mvn site:stage "$@"
echo "*****************************************" echo "*****************************************"
echo ">>>> Finished the site stage process <<<<" echo ">>>> Finished the site stage process <<<<"
echo "> You can check the content in the folder target/staging or by opening the following url" 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 "> "
echo "> If everything is fine enter yes. After that the publish process will be started." echo "> If everything is fine enter yes. After that the publish process will be started."
echo -n "Do you want to publish (yes/no)? " echo -n "Do you want to publish (yes/no)? "

View File

@ -96,6 +96,7 @@
<site.staging.base>${project.basedir}</site.staging.base> <site.staging.base>${project.basedir}</site.staging.base>
<scmPubCheckoutDirectory>.site-content</scmPubCheckoutDirectory> <scmPubCheckoutDirectory>.site-content</scmPubCheckoutDirectory>
<scmPublishBranch>asf-staging</scmPublishBranch> <scmPublishBranch>asf-staging</scmPublishBranch>
<scmPublishPath>/redback/core/${project.version}</scmPublishPath>
<!-- The git repository, where the site content is placed --> <!-- The git repository, where the site content is placed -->
<siteRepositoryUrl>scm:git:https://gitbox.apache.org/repos/asf/archiva-web-content.git</siteRepositoryUrl> <siteRepositoryUrl>scm:git:https://gitbox.apache.org/repos/asf/archiva-web-content.git</siteRepositoryUrl>
@ -753,7 +754,7 @@
<inputEncoding>UTF-8</inputEncoding> <inputEncoding>UTF-8</inputEncoding>
<outputEncoding>UTF-8</outputEncoding> <outputEncoding>UTF-8</outputEncoding>
<skipDeploy>true</skipDeploy> <skipDeploy>true</skipDeploy>
<stagingDirectory>${site.staging.base}/target/staging/redback/core/${project.version}</stagingDirectory> <stagingDirectory>${site.staging.base}/target/staging${scmPublishPath}/</stagingDirectory>
</configuration> </configuration>
<executions> <executions>
<execution> <execution>

View File

@ -51,7 +51,7 @@
<body> <body>
<head> <head>
<![CDATA[<link rel="stylesheet" href="../css/site.css" type="text/css" />]]> <![CDATA[<link rel="stylesheet" href="/css/site.css" type="text/css" />]]>
</head> </head>
<breadcrumbs> <breadcrumbs>