Files
python-prettymaps-mirror/.github/workflows/generate-readme.yml

59 lines
1.5 KiB
YAML

name: Generate README
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
jobs:
generate-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run setup.sh
run: |
bash setup.sh
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install nbconvert
run: |
pip install nbconvert
- name: Install jupyter
run: |
pip install jupyter
- name: Install package
run: |
pip install -e .
- name: Execute the notebook (run all cells)
run: |
jupyter nbconvert --to notebook --execute notebooks/examples.ipynb --output examples.ipynb --output-dir notebooks
- name: Run notebooks_to_readme.sh
run: |
bash scripts/notebooks_to_readme.sh
- name: Git add generated files
run: |
git add README.md notebooks/examples.ipynb pictures/README/*.png
- name: Commit changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "Update README, notebook, and images from CI" || echo "No changes to commit"
- name: Push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push origin HEAD:${GITHUB_REF#refs/heads/}