Trigger build of docs-base after successful build of archive branch

This commit is contained in:
Misty Stanley-Jones
2017-03-06 15:18:18 -08:00
committed by Misty Stanley-Jones
parent 7a500c0fe3
commit 5249ec11a5
3 changed files with 16 additions and 8 deletions

2
.dockerignore Normal file
View File

@@ -0,0 +1,2 @@
.git
_site

View File

@@ -1,11 +1,3 @@
FROM starefossen/github-pages:onbuild
ONBUILD RUN git clone https://www.github.com/docker/docker.github.io docs
ONBUILD WORKDIR docs
ONBUILD RUN git checkout v1.5
ONBUILD COPY . /usr/src/app
CMD jekyll serve -d /_site --watch -H 0.0.0.0 -P 4000

14
hooks/post_push Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
set -e
# If this is an archive branch (like v1.4 or v1.11),
# build and push the docs-base branch at the end of
# a successful build of the branch
if [[ $SOURCE_BRANCH =~ ^v1\.[0-9]+$ ]]; then
git fetch origin docs-base:docs-base --depth 1 || ( echo "Couldn't fetch docs-base." && exit 1 )
git checkout docs-base || ( echo "Couldn't check out docs-base." && exit 1 )
docker build -t docs/docker.github.io:docs-base . || ( echo "Couldn't build docs-base Dockerfile." && exit 1 )
docker push docs/docker.github.io:docs-base || ( echo "Coudn't push new docs-base image." && exit 1 )
fi