push-notebook #57
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: notebook_to_md (gridded) | |
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/gridded/example_files | |
ls /home/runner/work/COAsT-site/COAsT-site/external/example_scripts/notebook_tutorials/runnable_notebooks/gridded/example_files | |
mkdir -p ./example_scripts/notebook_tutorials/markdown/gridded | |
ls ./example_scripts/notebook_tutorials | |
pip install . | |
mv config ./example_scripts/notebook_tutorials/runnable_notebooks/gridded/config | |
bash notebook_to_md.sh gridded | |
- name: convert notebooks | |
run: | | |
cd $GITHUB_WORKSPACE/external/example_scripts/notebook_tutorials/ | |
ls ./markdown | |
echo "Move gridded markdown examples" | |
mv ./markdown/gridded/introduction_to_gridded_class.md $GITHUB_WORKSPACE/site/content/en/docs/Examples/Notebooks/Gridded/ | |
mv ./markdown/gridded/contour_tutorial.md $GITHUB_WORKSPACE/site/content/en/docs/Examples/Notebooks/Gridded/ | |
mv ./markdown/gridded/transect_tutorial.md $GITHUB_WORKSPACE/site/content/en/docs/Examples/Notebooks/Gridded/ | |
mv ./markdown/gridded/regridding_with_xesmf_tutorial.md $GITHUB_WORKSPACE/site/content/en/docs/Examples/Notebooks/Gridded/ | |
mv ./markdown/gridded/pycnocline_tutorial.md $GITHUB_WORKSPACE/site/content/en/docs/Examples/Notebooks/Gridded/ | |
mv ./markdown/gridded/seasia_dic_example_plot_tutorial.md $GITHUB_WORKSPACE/site/content/en/docs/Examples/Notebooks/Gridded/ | |
mv ./markdown/gridded/potential_energy_tutorial.md $GITHUB_WORKSPACE/site/content/en/docs/Examples/Notebooks/Gridded/ | |
echo "Move images" | |
rsync -r ./markdown_images/gridded/ $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/Gridded/* | |
git add static/* | |
git commit -am "Updated Gridded notebook pages from coast repo." | |
git push origin develop |