Update Temoa results #137
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: Run Jupyter Notebook | |
on: push | |
permissions: | |
contents: write | |
jobs: | |
run_notebook: | |
runs-on: ubuntu-latest # You can choose a different runner if needed | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Install Environment with Micromamba | |
uses: mamba-org/setup-micromamba@main | |
with: | |
environment-file: environment.yml | |
cache-environment: true | |
init-shell: bash | |
post-cleanup: 'all' | |
# - run: mamba activate mip_figures | |
# - run: | | |
# conda info | |
# conda list | |
# conda config --show-sources | |
# conda config --show | |
# printenv | sort | |
# - name: Set up Python | |
# uses: actions/setup-python@v4 | |
# with: | |
# python-version: '3.10' # Choose the desired Python version | |
# cache: 'pip' | |
# cache-dependency-path: | | |
# **/requirements*.txt | |
# - uses: actions/cache@v1 | |
# id: cache | |
# with: | |
# path: ~/.cache/pip | |
# key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
# restore-keys: | | |
# ${{ runner.os }}-pip- | |
# - name: Install | |
# if: steps.cache.outputs.cache-hit != 'true' | |
# run: | | |
# pip install -r requirements.txt | |
# ipython kernel install --name "python3" --user | |
- name: Configure Git | |
run: | | |
git config --global user.name "${{ github.actor }}" | |
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
# - name: Discover Scripts | |
# run: | | |
# echo "scripts=$(find . -name "*.py")" >> $GITHUB_OUTPUT | |
# id: discover_scripts | |
# - name: Run Notebooks | |
# run: | | |
# for notebook in ${{ steps.discover_notebooks.outputs.notebooks }}; do | |
# echo "$notebook" | |
# notebook_dir=$(dirname "$notebook") | |
# cd "$notebook_dir" | |
# jupyter nbconvert --to notebook --execute "$(basename "$notebook")" | |
# cd - | |
# done | |
- name: Run Scripts | |
run: | | |
python run_py_scripts.py | |
- name: Check for modified files | |
id: git-check | |
run: | | |
echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT | |
if git diff-index --quiet HEAD --; then echo "no changed files"; else echo "some changed files"; fi | |
- name: Add changes | |
if: steps.git-check.outputs.modified == 'true' | |
run: | | |
git pull --rebase | |
git add . | |
git commit -m "Update figures" | |
echo "Commit done" | |
- name: Push changes to repository | |
if: steps.git-check.outputs.modified == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |