build jupyter book #197
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: on-push | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -l {0} | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- uses: pre-commit/[email protected] | |
build-book: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Get changed notebooks | |
id: changed-files | |
uses: tj-actions/changed-files@v44 | |
with: | |
files: | | |
**.ipynb | |
- name: Checkout book repo | |
uses: actions/checkout@v4 | |
with: | |
repository: ecmwf-projects/c3s_eqc_book_main | |
path: book | |
- name: Install jupyter-book | |
run: | | |
python -m pip install jupyter-book | |
- name: Build pages | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: |- | |
mkdir pages || exit | |
cd book/c3s_eqc_quality_assessments || exit | |
for fullfile in ${ALL_CHANGED_FILES}; do | |
filename=$(basename -- "$fullfile") | |
prefix="${filename%.*}" | |
cp ../../"$fullfile" "$filename" || exit | |
jupyter-book build "$filename" || exit | |
mv _build/_page/"$prefix"/html ../../pages/"$prefix" || exit | |
done | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: pages/* |