From c63ffdd3efed00384289d6a437c8fadf06159d85 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Thu, 12 Oct 2017 15:10:28 +0200 Subject: [PATCH] circle.yml: deploy docs when the master branch is updated Note that the push requires a specific private key in the libratbag circle CI organization, meaning that only the master branch of libratbag will be allowed to push to the doc repo. Note also that only the master branch will trigger the request: - any PR will not trigger the request - any push on the master branch of a personal repo will fail while attempting to write the docs, if the repo is setup to use circleCI too. Signed-off-by: Benjamin Tissoires --- circle.yml | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/circle.yml b/circle.yml index f2425e29..761ceac5 100644 --- a/circle.yml +++ b/circle.yml @@ -125,6 +125,38 @@ doc_build: &doc_build - *export_logs - store_artifacts: path: ~/libratbag/build/doc/html + - persist_to_workspace: + root: build + paths: + - doc/html/* + +docs_deploy: &docs_deploy + <<: *default_settings + steps: + - run: + name: Install prerequisites + command: dnf install -y git tree + - checkout + - attach_workspace: + at: build + - run: + name: Clone doc repository + command: | + cd ~ + git clone ssh://git@github.com/${CIRCLE_PROJECT_REPONAME}/${CIRCLE_PROJECT_REPONAME}.github.io + - run: + name: Copy the doc, commit and push + command: | + set +e + cd ~/${CIRCLE_PROJECT_REPONAME}.github.io + \cp -r ~/${CIRCLE_PROJECT_REPONAME}/build/doc/html/* . + if ! git diff-index --quiet HEAD --; then + git config --global user.email "libratbag@librabtag.github.io" + git config --global user.name "The libratbag crew" + git add . + git commit -m "update docs from ${CIRCLE_SHA1}" + git push + fi version: 2 jobs: @@ -148,6 +180,10 @@ jobs: <<: *scan_build_run docker: - image: fedora:latest + doc_deploy: + <<: *docs_deploy + docker: + - image: fedora:latest workflows: @@ -159,3 +195,9 @@ workflows: - ubuntu_17_04 - fedora_latest - doc_build + - doc_deploy: + requires: + - doc_build + filters: + branches: + only: master