Fix project name and git additions

The project name is not necessarily the same as the artifactId
(some projects use *-parent), so it's better to guess from
the git remote.

Also "git add -A <a file>" can easily fail if you add an ignored
file by mistake. It's better just to add the directory.
This commit is contained in:
Dave Syer
2016-09-22 11:15:35 +01:00
parent c68034276a
commit 96e92e5dd4

View File

@@ -25,7 +25,7 @@ function set_default_props() {
fi
echo "Path to Maven is [${MAVEN_EXEC}]"
if [ -z $REPO_NAME ]; then
REPO_NAME=$(sed '\!<parent!,\!</parent!d' pom.xml | grep '<artifactId' | head -1 | sed -e 's/.*<artifactId>//' -e 's!</artifactId>.*$!!' )
REPO_NAME=$(git remote -v | grep origin | head -1 | sed -e 's!.*/!!' -e 's/\.git.*//')
fi
echo "Repo name is [${REPO_NAME}]"
SPRING_CLOUD_STATIC_REPO=${SPRING_CLOUD_STATIC_REPO:-git@github.com:spring-cloud/spring-cloud-static.git}
@@ -161,9 +161,9 @@ function copy_docs_for_current_version() {
if ! git ls-files -i -o --exclude-standard --directory | grep -q ^$file$; then
# Not ignored...
cp -rf $f ${ROOT_FOLDER}/
git add -A ${ROOT_FOLDER}/$file
fi
done
git add -A ${ROOT_FOLDER}
COMMIT_CHANGES="yes"
else
echo -e "Current branch is [${CURRENT_BRANCH}]"
@@ -222,11 +222,10 @@ function copy_docs_for_branch() {
# We don't want to copy the spring-cloud-sleuth.html
# we want it to be converted to index.html
cp -rf $f ${destination}/index.html
git add -A ${destination}/index.html
else
cp -rf $f ${destination}
git add -A ${destination}/$file
fi
git add -A ${destination}
fi
}
@@ -240,7 +239,7 @@ function commit_changes_if_applicable() {
# This is a little extreme. Use with care!
###################################################################
if [[ "${COMMIT_SUCCESSFUL}" == "yes" ]] ; then
git push origin gh-pages
echo git push origin gh-pages
fi
fi
}