From db0bca74896f77fce5a3fb6dd61cf0fecd80c4e8 Mon Sep 17 00:00:00 2001 From: wsavran <35315438+wsavran@users.noreply.github.com> Date: Fri, 8 Sep 2023 13:29:29 -0700 Subject: [PATCH] Create new docs.yml --- .github/workflows/docs.yml | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..a6549be2 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,51 @@ +name: docs + +on: + push: + branches: [ master ] + +jobs: + build_docs: + runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} + + steps: + - uses: actions/checkout@v2 + - uses: mamba-org/setup-micromamba@v1 + with: + generate-run-shell: true + environment-file: requirements.yml + create-args: >- + python=3.10 + pillow + sphinx + sphinx-gallery + sphinx-rtd-theme + + - name: Install pyCSEP + run: | + pip install --no-deps -e . + python -c "import csep; print('Version: ', csep.__version__)" + + - name: Build documentation + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) + make -C docs clean + make -C docs html + doc_root=`mktemp -d` + rsync -av "docs/_build/html/" "${doc_root}/" + pushd "${doc_root}" + git config --global user.name "${GITHUB_ACTOR}" + git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" + git init + git remote add deploy "https://token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" + git checkout -b gh-pages + echo "Empty README.md for documenation cache." > README.md + echo "docs.cseptesting.org" > CNAME + git add . + git commit -am "Updating pyCSEP docs for commit ${GITHUB_SHA} made on `date -d"@{SOURCE_DATE_EPOCH} --iso-8601=seconds` from ${GITHUB_REF} by ${GITHUB_ACTOR}" + git push deploy gh-pages --force