Skip to content

Commit

Permalink
Merge pull request moby#10006 from jfrazelle/docs-release-fixes
Browse files Browse the repository at this point in the history
Update docs release script so we can have autodeploys
  • Loading branch information
Jessie Frazelle committed Jan 12, 2015
2 parents 966c8b0 + a6a748b commit 1781fed
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ docs/AWS_S3_BUCKET
docs/GIT_BRANCH
docs/VERSION
docs/GITCOMMIT
docs/changed-files
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ DOCKER_DOCS_IMAGE := docker-docs$(if $(GIT_BRANCH),:$(GIT_BRANCH))

DOCKER_RUN_DOCKER := docker run --rm -it --privileged $(DOCKER_ENVS) $(DOCKER_MOUNT) "$(DOCKER_IMAGE)"

DOCKER_RUN_DOCS := docker run --rm -it $(DOCS_MOUNT) -e AWS_S3_BUCKET
DOCKER_RUN_DOCS := docker run --rm -it $(DOCS_MOUNT) -e AWS_S3_BUCKET -e NOCACHE

# for some docs workarounds (see below in "docs-build" target)
GITCOMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
Expand Down Expand Up @@ -83,7 +83,7 @@ build: bundles
docker build -t "$(DOCKER_IMAGE)" .

docs-build:
git diff --name-status upstream/release..upstream/docs docs/ > docs/changed-files
( git remote | grep -v upstream ) || git diff --name-status upstream/release..upstream/docs docs/ > docs/changed-files
cp ./VERSION docs/VERSION
echo "$(GIT_BRANCH)" > docs/GIT_BRANCH
echo "$(AWS_S3_BUCKET)" > docs/AWS_S3_BUCKET
Expand Down
13 changes: 9 additions & 4 deletions docs/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ upload_current_documentation() {
src=site/
dst=s3://$BUCKET$1

cache=max-age=3600
if [ "$NOCACHE" ]; then
cache=no-cache
fi

echo
echo "Uploading $src"
echo " to $dst"
Expand All @@ -90,7 +95,7 @@ upload_current_documentation() {
# versions.html_fragment
include="--recursive --include \"*.$i\" "
echo "uploading *.$i"
run="aws s3 cp $src $dst $OPTIONS --profile $BUCKET --cache-control \"max-age=3600\" --acl public-read $include"
run="aws s3 cp $src $dst $OPTIONS --profile $BUCKET --cache-control $cache --acl public-read $include"
echo "======================="
echo "$run"
echo "======================="
Expand All @@ -114,7 +119,7 @@ invalidate_cache() {

len=${#files[@]}

echo "aws cloudfront create-invalidation --profile docs.docker.com --distribution-id $DISTRIBUTION_ID --invalidation-batch '" > batchfile
echo "aws cloudfront create-invalidation --profile $AWS_S3_BUCKET --distribution-id $DISTRIBUTION_ID --invalidation-batch '" > batchfile
echo "{\"Paths\":{\"Quantity\":$len," >> batchfile
echo "\"Items\": [" >> batchfile

Expand Down Expand Up @@ -150,12 +155,12 @@ if [ "$BUILD_ROOT" == "yes" ]; then
echo "Building root documentation"
build_current_documentation
upload_current_documentation
invalidate_cache
[ "$NOCACHE" ] || invalidate_cache
fi

#build again with /v1.0/ prefix
sed -i "s/^site_url:.*/site_url: \/$MAJOR_MINOR\//" mkdocs.yml
echo "Building the /$MAJOR_MINOR/ documentation"
build_current_documentation
upload_current_documentation "/$MAJOR_MINOR/"
invalidate_cache "/$MAJOR_MINOR"
[ "$NOCACHE" ] || invalidate_cache "/$MAJOR_MINOR"

0 comments on commit 1781fed

Please sign in to comment.