From 6eb73cac1e3a49a991c67e39752499bb7e027c49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Fredrik=20Ki=C3=A6r?= <31612826+anders-kiaer@users.noreply.github.com> Date: Fri, 27 Mar 2020 21:50:56 +0100 Subject: [PATCH] Deploy GitHub pages on merge to master (#11) --- .github/workflows/flownet.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/flownet.yml b/.github/workflows/flownet.yml index 347017323..d2e0de1d2 100644 --- a/.github/workflows/flownet.yml +++ b/.github/workflows/flownet.yml @@ -1,6 +1,9 @@ name: CI on: + push: + branches: + - master pull_request: branches: - master @@ -75,3 +78,23 @@ jobs: pushd docs make html popd + + - name: Update GitHub pages + if: github.ref == 'refs/heads/master' && matrix.python-version == '3.6' + run: | + cp -R ./docs/_build ../_build + git config --local user.email "flownet-github-action" + git config --local user.name "flownet-github-action" + git fetch origin gh-pages + git checkout --track origin/gh-pages + git clean -f -f -d -x + git rm -r * + + cp -R ../_build/html/* . + git add . + if git diff-index --quiet HEAD; then + echo "No changes in documentation. Skip documentation deploy." + else + git commit -m "Update Github Pages" + git push "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" gh-pages + fi