Skip to content

Update README

Update README #61

name: Github pages build and deployment
on:
push:
branches:
- "master"
- "main"
- "doc*"
#pull_request:
# types:
# - labeled
workflow_dispatch:
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 1
jobs:
build:
# if: ${{ github.event.label.name == 'documentation' }}
strategy:
matrix:
include:
- os: ubuntu-latest
label: linux-64
prefix: /usr/share/miniconda3/envs/docs
name: ${{ matrix.label }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: docs
auto-activate-base: false
use-mamba: true
- name: Set cache date
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
- uses: actions/cache@v2
with:
path: ${{ matrix.prefix }}
key: ${{ matrix.label }}-conda-${{ hashFiles('devtools/dev.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
id: cache
- name: Update environment
run: mamba env update -n docs -f devtools/dev.yml
if: steps.cache.outputs.cache-hit != 'true'
- name: Run sphinx and build docs
shell: bash -l {0}
run: |
cd docs
make html
#sphinx-build docs docs/_build/html/
# Create an artifact of the html output.
#- uses: actions/upload-artifact@v1
# with:
# name: DocumentationHTML
# path: docs/_build/html/
# Publish built docs to gh-pages branch.
# ===============================
#- name: Commit documentation changes
# run: |
# git clone https://github.com/cbc-univie/mdy-newanalysis-package --branch gh-pages --single-branch gh-pages
# cp -r docs/_build/html/* gh-pages/
# cd gh-pages
# touch .nojekyll
# git config --local user.email "[email protected]"
# git config --local user.name "GitHub Action"
# git add .
# git commit -m "Update documentation" -a || true
# # The above command will fail if no changes were present, so we ignore
# # that.
#- name: Push changes
# uses: ad-m/github-push-action@master
# with:
# branch: gh-pages
# directory: gh-pages
- uses: actions/upload-pages-artifact@v1
with:
path: docs/_build/html
# Deploy job
deploy:
# Add a dependency to the build job
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1