Skip to content

Commit

Permalink
Merge pull request #21 from harishmohanraj/update-workflow
Browse files Browse the repository at this point in the history
Update existing deploy job
  • Loading branch information
harishmohanraj authored Dec 19, 2024
2 parents f32bf30 + e6928f9 commit f9efe9a
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 110 deletions.
58 changes: 0 additions & 58 deletions .github/workflows/deploy-website-mintlify.yml

This file was deleted.

94 changes: 42 additions & 52 deletions .github/workflows/deploy-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ on:
pull_request:
branches: [main]
path:
- "autogen/*"
- "website/*"
- "autogen/**"
- "website/**"
- ".github/workflows/deploy-website.yml"
push:
branches: [main]
path:
- "autogen/*"
- "website/*"
- "autogen/**"
- "website/**"
- ".github/workflows/deploy-website.yml"
workflow_dispatch:
merge_group:
Expand All @@ -29,43 +29,34 @@ jobs:
- uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18.x
- name: setup python
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: pydoc-markdown install
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install pydoc-markdown pyyaml termcolor
pip install pydoc-markdown pyyaml termcolor nbconvert
# Pin databind packages as version 4.5.0 is not compatible with pydoc-markdown.
pip install databind.core==4.4.2 databind.json==4.4.2
- name: pydoc-markdown run
run: |
pydoc-markdown
- name: quarto install
working-directory: ${{ runner.temp }}
run: |
wget -q https://github.com/quarto-dev/quarto-cli/releases/download/v1.5.23/quarto-1.5.23-linux-amd64.tar.gz
tar -xzf quarto-1.5.23-linux-amd64.tar.gz
echo "$(pwd)/quarto-1.5.23/bin/" >> $GITHUB_PATH
- name: Process notebooks
- name: Install quarto
uses: quarto-dev/quarto-actions/setup@v2

- name: Generate API documentation
run: |
python process_notebooks.py render
- name: Test Build
python ./process_api_reference.py
working-directory: website

- name: Convert Jupyter notebooks to MDX
run: |
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile --ignore-engines
yarn build
elif [ -e package-lock.json ]; then
npm ci
npm run build
else
npm i --legacy-peer-deps
npm run build
fi
python ./process_notebooks.py render
working-directory: website

gh-release:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
Expand All @@ -76,46 +67,45 @@ jobs:
- uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18.x
- name: setup python
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: pydoc-markdown install
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install pydoc-markdown pyyaml termcolor
pip install pydoc-markdown pyyaml termcolor nbconvert
# Pin databind packages as version 4.5.0 is not compatible with pydoc-markdown.
pip install databind.core==4.4.2 databind.json==4.4.2
- name: pydoc-markdown run
run: |
pydoc-markdown
- name: quarto install
working-directory: ${{ runner.temp }}
- name: Install quarto
uses: quarto-dev/quarto-actions/setup@v2

- name: Generate API documentation
run: |
wget -q https://github.com/quarto-dev/quarto-cli/releases/download/v1.5.23/quarto-1.5.23-linux-amd64.tar.gz
tar -xzf quarto-1.5.23-linux-amd64.tar.gz
echo "$(pwd)/quarto-1.5.23/bin/" >> $GITHUB_PATH
- name: Process notebooks
python ./process_api_reference.py
working-directory: website

- name: Convert Jupyter notebooks to MDX
run: |
python process_notebooks.py render
- name: Build website
python ./process_notebooks.py render
working-directory: website

- name: Prepare website content
run: |
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile --ignore-engines
yarn build
elif [ -e package-lock.json ]; then
npm ci
npm run build
else
npm i --legacy-peer-deps
npm run build
fi
# Create a temporary directory for filtered content
mkdir -p temp_website
# Copy files except .ipynb, node_modules, .quarto, and .gitignore
find website -type f -not -path "*/node_modules/*" -not -path "*/.quarto/*" -not -name "*.ipynb" -not -name ".gitignore" -exec cp --parents {} temp_website/ \;
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Build output to publish to the `gh-pages` branch:
publish_dir: ./website/build
publish_dir: temp_website/website

0 comments on commit f9efe9a

Please sign in to comment.