diff --git a/.github/workflows/publish-book.yml b/.github/workflows/publish-book.yml index 4731afe..406bb04 100644 --- a/.github/workflows/publish-book.yml +++ b/.github/workflows/publish-book.yml @@ -1,65 +1,22 @@ + name: publish-book -# Trigger the workflow on push to main branch on: + # Trigger the workflow on push to main branch push: branches: - main -# This job installs dependencies, builds the book, and deploys the html + workflow_dispatch: + jobs: - build-and-deploy-book: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest] - python-version: [3.9] - steps: - - uses: actions/checkout@v2 - - name: Get PR number - run: echo "Your PR is ${PR}" - env: - PR: ${{ github.event.pull_request.number }} - - name: 📦 Cache Conda Packages - uses: actions/cache@v2 - env: - # Increase this value to reset cache if etc/example-environment.yml has not changed - CACHE_NUMBER: 0 - with: - path: ~/conda_pkgs_dir - key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('conda-linux-64.lock') }} - - name: 🐍 Set up Conda environment - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: false - activate-environment: DGM2lines - environment-file: conda-linux-64.lock - - name: 👀 Check Conda environment - shell: bash -l {0} - run: | - pip install -r requirements.txt - conda info - conda list - - name: 📦 Cache Notebooks - uses: actions/cache@v2 - with: - path: src/_build/.jupyter_cache - key: notebook_cache-${{hashFiles('_toc.yml', '_config.yml', 'environment.yml') }} - - name: 📖 Build the book - shell: bash -l {0} - run: | - cd src - mkdir -p _notebook_cache - jupyter-book build . - - name: 📖 Show logs from the book build - shell: bash -l {0} - run: | - find src/_build/html -name "*.log" -print -exec cat {} \; - - name: 🚀 Deploy to GitHub Pages - # redudant but keeping for testing purposes - if: github.ref == 'refs/heads/main' - uses: peaceiris/actions-gh-pages@v3.9.3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: src/_build/html - keep_files: false - force_orphan: true + build: + uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main + with: + environment_name: DGM2lines + path_to_notebooks: 'book' + + deploy: + needs: build + uses: ProjectPythia/cookbook-actions/.github/workflows/deploy-book.yaml@main + with: + publish_dir: "book/_build/html" diff --git a/.github/workflows/trigger-book-build.yml b/.github/workflows/trigger-book-build.yml index bbb1d3d..44d847a 100644 --- a/.github/workflows/trigger-book-build.yml +++ b/.github/workflows/trigger-book-build.yml @@ -3,47 +3,11 @@ on: pull_request: jobs: - install-dependencies: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest] - python-version: [3.9] - steps: - - uses: actions/checkout@v2 - - name: Get PR number - run: echo "Your PR is ${PR}" - env: - PR: ${{ github.event.pull_request.number }} - - name: 📦 Cache Conda Packages - uses: actions/cache@v2 - env: - # Increase this value to reset cache if etc/example-environment.yml has not changed - CACHE_NUMBER: 0 - with: - path: ~/conda_pkgs_dir - key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('conda-linux-64.lock') }} - - name: 🐍 Set up Conda environment - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: false - activate-environment: DGM2lines - environment-file: conda-linux-64.lock - - name: 👀 Check Conda environment - shell: bash -l {0} - run: | - pip install -r requirements.txt - conda info - conda list - - name: 📦 Cache Notebooks - uses: actions/cache@v2 - with: - path: _build/.jupyter_cache - key: notebook_cache-${{hashFiles('_toc.yml', '_config.yml', 'environment.yml') }} build: uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main with: environment_name: DGM2lines artifact_name: book-zip-${{ github.event.number }} - path_to_notebooks: "src" + path_to_notebooks: "book" build_command: "jupyter-book build --keep-going ." + # Other input options are possible, see ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml diff --git a/.github/workflows/trigger-preview.yml b/.github/workflows/trigger-preview.yml index 87eb697..1e39215 100644 --- a/.github/workflows/trigger-preview.yml +++ b/.github/workflows/trigger-preview.yml @@ -7,9 +7,6 @@ on: - requested - completed -permissions: - contents: write - jobs: find-pull-request: uses: ProjectPythia/cookbook-actions/.github/workflows/find-pull-request.yaml@main @@ -21,8 +18,8 @@ jobs: artifact_name: book-zip-${{ needs.find-pull-request.outputs.number }} destination_dir: _preview/${{ needs.find-pull-request.outputs.number }} # deploy to subdirectory labeled with PR number is_preview: 'true' - publish_dir: "src/_build/html" - github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: "book/_build/html" + # cname: foundations.projectpythia.org preview-comment: needs: find-pull-request diff --git a/.gitignore b/.gitignore index 86d5bdb..02e277f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ _build/ *.npz *.pth _build/* -src/_build/* +book/_build/* _notebook_cache/* notebooks/Source.gv notebooks/*.pkl diff --git a/src/_config.yml b/book/_config.yml similarity index 100% rename from src/_config.yml rename to book/_config.yml diff --git a/src/_toc.yml b/book/_toc.yml similarity index 100% rename from src/_toc.yml rename to book/_toc.yml diff --git a/src/assets/Aghulas.gif b/book/assets/Aghulas.gif similarity index 100% rename from src/assets/Aghulas.gif rename to book/assets/Aghulas.gif diff --git a/src/assets/Atlantic.gif b/book/assets/Atlantic.gif similarity index 100% rename from src/assets/Atlantic.gif rename to book/assets/Atlantic.gif diff --git a/src/assets/Global.gif b/book/assets/Global.gif similarity index 100% rename from src/assets/Global.gif rename to book/assets/Global.gif diff --git a/src/assets/Pacific.gif b/book/assets/Pacific.gif similarity index 100% rename from src/assets/Pacific.gif rename to book/assets/Pacific.gif diff --git a/src/assets/newlogo.png b/book/assets/newlogo.png similarity index 100% rename from src/assets/newlogo.png rename to book/assets/newlogo.png diff --git a/src/intro.md b/book/intro.md similarity index 100% rename from src/intro.md rename to book/intro.md diff --git a/src/notebooks/MOM6_basic_plotting.ipynb b/book/notebooks/MOM6_basic_plotting.ipynb similarity index 100% rename from src/notebooks/MOM6_basic_plotting.ipynb rename to book/notebooks/MOM6_basic_plotting.ipynb diff --git a/src/notebooks/OM4_SE_animation.ipynb b/book/notebooks/OM4_SE_animation.ipynb similarity index 100% rename from src/notebooks/OM4_SE_animation.ipynb rename to book/notebooks/OM4_SE_animation.ipynb diff --git a/src/notebooks/OM4_SST_Bias.ipynb b/book/notebooks/OM4_SST_Bias.ipynb similarity index 100% rename from src/notebooks/OM4_SST_Bias.ipynb rename to book/notebooks/OM4_SST_Bias.ipynb diff --git a/src/notebooks/OM4_misc.ipynb b/book/notebooks/OM4_misc.ipynb similarity index 100% rename from src/notebooks/OM4_misc.ipynb rename to book/notebooks/OM4_misc.ipynb diff --git a/src/notebooks/data/N2_ePBL_data_timemean_1978-2002.nc b/book/notebooks/data/N2_ePBL_data_timemean_1978-2002.nc similarity index 100% rename from src/notebooks/data/N2_ePBL_data_timemean_1978-2002.nc rename to book/notebooks/data/N2_ePBL_data_timemean_1978-2002.nc diff --git a/src/notebooks/data/ocean_static_rm2.nc b/book/notebooks/data/ocean_static_rm2.nc similarity index 100% rename from src/notebooks/data/ocean_static_rm2.nc rename to book/notebooks/data/ocean_static_rm2.nc diff --git a/src/notebooks/data/so_ePBL_data_timemean_1978-2002.nc b/book/notebooks/data/so_ePBL_data_timemean_1978-2002.nc similarity index 100% rename from src/notebooks/data/so_ePBL_data_timemean_1978-2002.nc rename to book/notebooks/data/so_ePBL_data_timemean_1978-2002.nc diff --git a/src/notebooks/data/thetao_ePBL_data_timemean_1978-2002.nc b/book/notebooks/data/thetao_ePBL_data_timemean_1978-2002.nc similarity index 100% rename from src/notebooks/data/thetao_ePBL_data_timemean_1978-2002.nc rename to book/notebooks/data/thetao_ePBL_data_timemean_1978-2002.nc diff --git a/src/notebooks/helpers/collection_of_experiments.py b/book/notebooks/helpers/collection_of_experiments.py similarity index 100% rename from src/notebooks/helpers/collection_of_experiments.py rename to book/notebooks/helpers/collection_of_experiments.py diff --git a/src/notebooks/helpers/computational_tools.py b/book/notebooks/helpers/computational_tools.py similarity index 100% rename from src/notebooks/helpers/computational_tools.py rename to book/notebooks/helpers/computational_tools.py diff --git a/src/notebooks/helpers/experiment.py b/book/notebooks/helpers/experiment.py similarity index 100% rename from src/notebooks/helpers/experiment.py rename to book/notebooks/helpers/experiment.py diff --git a/src/notebooks/helpers/netcdf_cache.py b/book/notebooks/helpers/netcdf_cache.py similarity index 100% rename from src/notebooks/helpers/netcdf_cache.py rename to book/notebooks/helpers/netcdf_cache.py diff --git a/src/notebooks/helpers/plot_helpers.py b/book/notebooks/helpers/plot_helpers.py similarity index 100% rename from src/notebooks/helpers/plot_helpers.py rename to book/notebooks/helpers/plot_helpers.py diff --git a/src/notebooks/pycnocline_depth_mom6.ipynb b/book/notebooks/pycnocline_depth_mom6.ipynb similarity index 100% rename from src/notebooks/pycnocline_depth_mom6.ipynb rename to book/notebooks/pycnocline_depth_mom6.ipynb diff --git a/src/notebooks/xarray_intro.ipynb b/book/notebooks/xarray_intro.ipynb similarity index 100% rename from src/notebooks/xarray_intro.ipynb rename to book/notebooks/xarray_intro.ipynb diff --git a/src/notebooks/xgcm_intro.ipynb b/book/notebooks/xgcm_intro.ipynb similarity index 100% rename from src/notebooks/xgcm_intro.ipynb rename to book/notebooks/xgcm_intro.ipynb diff --git a/src/references.bib b/book/references.bib similarity index 100% rename from src/references.bib rename to book/references.bib