Add files via upload #95
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: | |
branches: [main, dev] | |
name: Quarto Publish | |
permissions: | |
contents: write | |
pages: write | |
jobs: | |
build-deploy: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout Quarto Book | |
if: github.ref == 'refs/heads/main' | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Checkout Pythia Book | |
if: github.ref == 'refs/heads/main' | |
uses: actions/checkout@v4 | |
with: | |
repository: tuw-geo/eo-datascience-cookbook | |
path: pythia | |
fetch-depth: 0 | |
token: ${{ secrets.BOT_TOKEN }} | |
persist-credentials: true | |
- name: Checkout Quarto Book Branch dev | |
if: github.ref == 'refs/heads/dev' | |
uses: actions/checkout@v4 | |
with: | |
ref: dev | |
fetch-depth: 0 | |
- name: Checkout Pythia Book Branch dev | |
if: github.ref == 'refs/heads/dev' | |
uses: actions/checkout@v4 | |
with: | |
ref: dev | |
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: Restore Cache Conda Environments | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
~/.local/share/jupyter/kernels | |
~/.cache/pip | |
/usr/share/miniconda/envs | |
key: ${{ runner.os }}-conda-${{ hashFiles('chapters/*.yml') }} | |
- 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: Save Cache Conda Environments | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
~/.local/share/jupyter/kernels | |
~/.cache/pip | |
/usr/share/miniconda/envs | |
key: ${{ runner.os }}-conda-${{ hashFiles('chapters/*.yml') }} | |
# - name: Cache Binder Build on mybinder.org | |
# uses: jupyterhub/repo2docker-action@master | |
# with: | |
# NO_PUSH: true | |
# MYBINDERORG_TAG: ${{ github.event.ref }} | |
# REPO2DOCKER_EXTRA_ARGS: --subdir notebooks | |
- name: Commit Files Quarto Book | |
if: github.ref == 'refs/heads/main' | |
run: | | |
NB_PATH=./notebooks/* | |
git config --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "[email protected]" | |
git commit ${NB_PATH[*]} -m "Quarto output" || echo "No changes to commit" | |
git push || echo "No changes to commit" | |
- name: Commit Files Pythia Book | |
if: github.ref == 'refs/heads/main' | |
run: | | |
pip install . | |
python src/eo_datascience/render_sfinx_toc.py | |
python src/eo_datascience/clean_nb.py | |
cp ./_toc.yml ./pythia/ | |
cp ./Makefile ./pythia/ | |
cp ./chapters/references.bib ./pythia/notebooks/ | |
cp -R ./notebooks/. ./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" | |
- name: Commit Files Quarto Book Branch dev | |
if: github.ref == 'refs/heads/dev' | |
run: | | |
NB_PATH=./notebooks/* | |
git config --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "[email protected]" | |
git commit ${NB_PATH[*]} -m "Quarto output" || echo "No changes to commit" | |
git push || echo "No changes to commit" | |
- name: Commit Files Pythia Book Branch dev | |
if: github.ref == 'refs/heads/dev' | |
run: | | |
pip install . | |
python src/eo_datascience/render_sfinx_toc.py | |
python src/eo_datascience/clean_nb.py | |
cp ./_toc.yml ./pythia/ | |
cp ./Makefile ./pythia/ | |
cp ./chapters/references.bib ./pythia/notebooks/ | |
cp -R ./notebooks/. ./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" | |