update redistribute notebook #180
Workflow file for this run
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: Build Pages | |
on: | |
push: | |
branches: | |
- master | |
- stable | |
- v1.5.3 | |
pull_request: | |
branches: | |
- master | |
- stable | |
- v1.5.3 | |
jobs: | |
build_pages: | |
name: Build Pages | |
runs-on: ubuntu-latest | |
container: ghcr.io/oggm/oggm:latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Fix git permission check | |
run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- name: Cache | |
uses: TimoRoth/cache@re-eval-key | |
with: | |
path: /github/home/OGGM/download_cache | |
key: oggm-download-cache-${{ hashFiles('dl_file_list.txt') }} | |
restore-keys: | | |
oggm-download-cache- | |
reeval-key: true | |
- name: Install Dependencies | |
run: | | |
${PIP} install --upgrade pip setuptools wheel | |
${PIP} install -r requirements.txt | |
${PIP} uninstall -y progressbar2 | |
- name: Build Book | |
run: | | |
jupyter-book build . | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-output | |
path: _build/ | |
- name: Push Book | |
if: github.event_name != 'pull_request' | |
run: | | |
${PIP} install ghp-import | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@bots.github.com" | |
git fetch origin gh-pages | |
ghp-import -n -p -f -b gh-pages -x "${GITHUB_REF##*/}" -m "Update ${GITHUB_REF##*/} docs from ${GITHUB_SHA}" _build/html | |
- name: Shrink download cache | |
shell: bash | |
run: | | |
set +o pipefail | |
while [[ "$(du -sm /github/home/OGGM/download_cache | cut -f1)" -gt "9500" ]]; do | |
FF="$(find /github/home/OGGM/download_cache -type f -exec du -a {} + | sort -nr | head -n1 | cut -f2)" | |
echo "Deleting $FF" | |
rm "$FF" | |
done | |
find /github/home/OGGM/download_cache -type f > "$GITHUB_WORKSPACE"/dl_file_list.txt |