JOSS #3 (#78) #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Docs 📚" | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Miniconda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
auto-update-conda: true | |
miniconda-version: "latest" | |
python-version: 3.11 | |
activate-environment: torchsurv | |
- name: Get Date | |
id: get-date | |
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache Conda env | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.CONDA }}/envs | |
key: | |
conda-${{ runner.os }}--${{ runner.arch }}--${{ steps.get-date.outputs.today }}-${{ hashFiles('dev/environment.yml') }}-${{ env.CACHE_NUMBER }} | |
env: | |
# Increase this value to reset cache if environment.yml has not changed | |
CACHE_NUMBER: 0 | |
- name: Update conda environment | |
run: | |
conda env update -n torchsurv -f dev/environment.yml | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Build docs | |
shell: bash -l {0} | |
run: | | |
conda activate torchsurv | |
./dev/build-docs.sh | |
- name: Deploy to GitHub Pages | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email 'actions@github.com' | |
git checkout --orphan gh-pages | |
cd docs/_build/html && tar czvf /tmp/docs.tar.gz * && cd ../../.. | |
git reset --hard | |
git clean -fdx | |
tar xvf /tmp/docs.tar.gz | |
touch .nojekyll # Prevents GitHub Pages from ignoring files that start with an underscore | |
git add . | |
git commit -m "Deploy GitHub Pages" | |
git push -f origin gh-pages |