Skip to content

Merge pull request #39 from TUW-GEO/npikall-patch-1 #2

Merge pull request #39 from TUW-GEO/npikall-patch-1

Merge pull request #39 from TUW-GEO/npikall-patch-1 #2

Workflow file for this run

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
if: github.ref == 'refs/heads/main'
run: |
python -m pip install .
render_sfinx_toc ./pythia
clean_nb ./chapters ./pythia/notebooks
cp ./Makefile ./pythia/
cp ./chapters/references.bib ./pythia/notebooks/
cp $(find notebooks -name "*.yml") ./pythia/notebooks/
cd ./pythia
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"