Commit 1923b404 by Johannes Edmeier

Auto-deploy for docs to gh-pages

parent 00ef6b35
......@@ -23,6 +23,7 @@
<build-plugin.coveralls.version>4.0.0</build-plugin.coveralls.version>
<build-plugin.gpg.version>1.6</build-plugin.gpg.version>
<build-plugin.asciidoctor.version>1.5.2</build-plugin.asciidoctor.version>
<build-plugin.exec.version>1.4.0</build-plugin.exec.version>
</properties>
<modules>
<module>spring-boot-admin-server</module>
......@@ -101,6 +102,11 @@
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>${build-plugin.asciidoctor.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${build-plugin.exec.version}</version>
</plugin>
</plugins>
</pluginManagement>
</build>
......
#!/bin/bash
##
# Makes a shallow clone for gh-pages branch, copies the new docs, adds, commits and pushes 'em.
#
# Requires the environment variable GH_TOKEN to be set to a valid GitHub-api-token.
#
# Usage:
# ./deploy-gh-pages.sh <project-version>
#
# project-version The version folder to use in gh-pages
##
set -o errexit -o nounset
PROJECT_VERSION=$1
GH_URL="https://${GH_TOKEN}@github.com/codecentric/spring-boot-admin.git"
TEMPDIR="$(mktemp -d /tmp/gh-pages.XXX)"
echo "Cloning gh-pages branch..."
git clone --branch gh-pages --single-branch --depth 1 --config user.name="Johannes Edmeier" --config user.email="johannes.edmeier@gmail.com" "$GH_URL" "$TEMPDIR"
if [[ -d "$TEMPDIR"/"${PROJECT_VERSION}-SNAPSHOT" ]]; then
echo "Removing ${PROJECT_VERSION}-SNAPSHOT..."
rm -rf "$TEMPDIR"/"${PROJECT_VERSION}-SNAPSHOT"
fi
echo "Copying new docs..."
mkdir -p "$TEMPDIR"/"${PROJECT_VERSION}"
cp -r target/generated-docs/* "$TEMPDIR"/"${PROJECT_VERSION}"/
pushd "$TEMPDIR" >/dev/null
git add .
if git diff-index --quiet HEAD; then
echo "No changes detected."
else
echo "Commit changes..."
git commit --message "Docs for ${PROJECT_VERSION}"
echo "Pushing gh-pages..."
git push origin gh-pages
fi
popd >/dev/null
rm -rf "$TEMPDIR"
exit 0
......@@ -37,6 +37,25 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>deploy-gh-pages</id>
<phase>deploy</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>./deploy-gh-pages.sh</executable>
<arguments>
<argument>${project.version}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment