Skip to content

Commit

Permalink
Create deploy-gh-pages.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
cudeso authored Jan 21, 2025
1 parent bf211e8 commit 42bf354
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/deploy-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Deploy Documentation to GitHub Pages

on:
push:
branches:
- main # Trigger only on changes to the main branch
workflow_dispatch: # Allows manual trigger

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Install dependencies
run: |
pip install nbconvert
- name: Convert Jupyter notebooks to HTML
run: |
find doc/ -name "*.ipynb" -exec jupyter nbconvert --to html {} \;
- name: Prepare documentation files
run: |
mkdir -p _site
cp -r doc/* _site/
# Convert markdown links from .md to .html
find _site -type f -name "*.md" -exec sed -i 's/\.md/\.html/g' {} \;
# Rename markdown files to HTML
find _site -type f -name "*.md" -exec bash -c 'mv "$0" "${0%.md}.html"' {} \;
- name: Deploy to gh-pages branch
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site
branch: gh-pages
force_orphan: true # Ensure gh-pages branch only contains docs

0 comments on commit 42bf354

Please sign in to comment.