AReaL/.github/workflows/deploy-docs.yml

59 lines
1.6 KiB
YAML

name: Deploy Jupyter Book to GitHub Pages
on:
push:
branches: [ main ] # Change to your default branch if different
pull_request:
branches: [ main ]
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
# Sets permissions of the GITHUB_TOKEN
permissions:
contents: read
pages: write
id-token: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12' # Adjust version as needed
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install jupyter-book ghp-import
# Install additional dependencies if you have a requirements.txt
# pip install -r requirements.txt
- name: Build the book
run: |
jupyter-book build docs
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main' # Only deploy on main branch
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.DEPLOY_TOKEN }}@github.com/${{ github.repository }}.git
ghp-import -n -p -f docs/_build/html