Skip to content

push-notebook

push-notebook #63

name: notebook_to_md (general)
on:
# External webhook trigger
repository_dispatch:
types: [push-notebook]
jobs:
commit-notebooks:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout site
uses: actions/checkout@v4
with:
submodules: recursive # Fetch Hugo themes and all extra projects
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
path: site
- name: Checkout coast
uses: actions/checkout@v4
with:
repository: British-Oceanographic-Data-Centre/COAsT
ref: develop
path: external
- name: Prepare environement
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: coast
environment-file: external/environment.yml
- name: prep exec notebooks
run: |
conda info
conda list
conda config --show
cd $GITHUB_WORKSPACE/external
sudo apt install wget unzip -y
wget -q https://linkedsystems.uk/erddap/files/COAsT_example_files/COAsT_example_files.zip
unzip COAsT_example_files.zip && mv COAsT_example_files ./example_scripts/notebook_tutorials/runnable_notebooks/general/example_files
ls /home/runner/work/COAsT-site/COAsT-site/external/example_scripts/notebook_tutorials/runnable_notebooks/general/example_files
mkdir -p ./example_scripts/notebook_tutorials/markdown/general
ls ./example_scripts/notebook_tutorials
pip install .
sudo apt-get update
sudo apt-get install -y libgeos-dev
pip install cartopy==0.21.0
mv config ./example_scripts/notebook_tutorials/runnable_notebooks/general/config
bash notebook_to_md.sh general
- name: convert notebooks
run: |
cd $GITHUB_WORKSPACE/external/example_scripts/notebook_tutorials/
ls ./markdown
echo "Move general stuff markdown examples"
mv ./markdown/general/export_to_netcdf_tutorial.md $GITHUB_WORKSPACE/site/content/en/docs/Examples/Notebooks/General/
mv ./markdown/general/seasonal_decomp_example.md $GITHUB_WORKSPACE/site/content/en/docs/Examples/Notebooks/General/
mv ./markdown/general/eof_tutorial.md $GITHUB_WORKSPACE/site/content/en/docs/Examples/Notebooks/General/
mv ./markdown/general/climatology_tutorial.md $GITHUB_WORKSPACE/site/content/en/docs/Examples/Notebooks/General/
mv ./markdown/general/dask_wrapper_template_tutorial.md $GITHUB_WORKSPACE/site/content/en/docs/Examples/Notebooks/General/
mv ./markdown/general/mask_maker_tutorial.md $GITHUB_WORKSPACE/site/content/en/docs/Examples/Notebooks/General/
mv ./markdown/general/polar_plotting.md $GITHUB_WORKSPACE/site/content/en/docs/Examples/Notebooks/General/
mv ./markdown/general/zarr_files.md $GITHUB_WORKSPACE/site/content/en/docs/Examples/Notebooks/General/
echo "Move images"
rsync -r ./markdown_images/general/ $GITHUB_WORKSPACE/site/static
- name: commit changes
run: |
cd $GITHUB_WORKSPACE/site
git config --global user.name "MarkDownBot"
git config --global author.name "MarkDownBot"
git config --global user.email "[email protected]"
git config --global author.email "[email protected]"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git fetch origin
git checkout develop
git pull
git add content/en/docs/Examples/Notebooks/General/*
git add static/*
git commit -am "Updated General notebook pages from coast repo."
git push origin develop