Merge pull request #48 from TUW-GEO/dev #8
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
on: | |
workflow_dispatch: | |
push: | |
tags: [ v* ] | |
# When a tag like v2024.11.27 is created, the workflow will be triggered | |
# Should follow https://calver.org/ for versioning | |
name: Pythia Publish | |
permissions: | |
contents: write | |
pages: write | |
jobs: | |
build-deploy: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout Quarto Book | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Checkout Pythia Book | |
uses: actions/checkout@v4 | |
with: | |
repository: tuw-geo/eo-datascience-cookbook | |
path: pythia | |
fetch-depth: 0 | |
token: ${{ secrets.BOT_TOKEN }} | |
persist-credentials: true | |
- name: Set up Quarto | |
uses: quarto-dev/quarto-actions/setup@v2 | |
- name: Install Python and Jupyter | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
- run: pip install jupyter jupyter-cache | |
- name: Cache Environment | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.local/share/jupyter/kernels | |
~/.cache/pip | |
/usr/share/miniconda/envs | |
./chapters/courses/.jupyter_cache | |
./chapters/courses/microwave-remote-sensing/.jupyter_cache | |
./chapters/templates/.jupyter_cache | |
./chapters/tutorials/.jupyter_cache | |
key: ${{ runner.os }}-env-${{ hashFiles('./environment.yml', './notebooks/**/*.yml') }} | |
restore-keys: ${{ runner.os }}-env- | |
- name: Render and Publish | |
id: setup-python | |
uses: quarto-dev/quarto-actions/publish@v2 | |
with: | |
target: gh-pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Commit Files Pythia Book | |
run: | | |
python -m pip install . | |
python -m pip install nbstripout | |
render_sfinx_toc ./pythia | |
clean_nb ./notebooks ./pythia/notebooks | |
cp -rf ./Makefile ./pythia/ | |
cp -rf ./chapters/references.bib ./pythia/notebooks/ | |
cp -rf --parents ./notebooks/images ./pythia | |
cp -rf --parents $(find notebooks -name "*.yml") ./pythia | |
cd ./pythia | |
find . -name '*.ipynb' -exec nbstripout {} + | |
git config --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "[email protected]" | |
git add . | |
git commit -m "Quarto output" || echo "No changes to commit" | |
git push || echo "No changes to commit" |