Commit f7dd101c authored by Wenhao Xie's avatar Wenhao Xie Committed by GitHub
Browse files

[Doc][CI] Update GitHub Actions workflow for documentation build and deployment. (#42)

* [Doc][CI] Update GitHub Actions workflow for documentation build and deployment.

* [Doc][CI] Remove redundant git add command in GitHub Actions workflow.

* [CI] Add workflow_dispatch trigger to publish_docs workflow
parent 3f38c10c
...@@ -4,6 +4,7 @@ on: ...@@ -4,6 +4,7 @@ on:
pull_request: pull_request:
types: types:
- closed - closed
workflow_dispatch:
permissions: permissions:
contents: write contents: write
...@@ -12,23 +13,33 @@ jobs: ...@@ -12,23 +13,33 @@ jobs:
docs: docs:
if: ${{ github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' }} if: ${{ github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
defaults:
run:
working-directory: ./docs
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
- name: Install dependencies - name: Build docs
run: | run: |
pip install -r requirements.txt chmod +x ./maint/scripts/build_docs.sh
- name: Sphinx build ./maint/scripts/build_docs.sh
- name: Configure git
run: | run: |
make html git config --global user.email "tilelang@outlook.com"
cp CNAME _build/html git config --global user.name "GitHub Actions"
- name: Deploy to GitHub Pages - name: Push to another repo
uses: peaceiris/actions-gh-pages@v3 env:
with: TARGET_REPO: ${{ secrets.TARGET_REPO }}
publish_branch: gh-pages TARGET_TOKEN: ${{ secrets.TARGET_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }} run: |
publish_dir: docs/_build/html git config --global url."https://$TARGET_TOKEN@github.com".insteadOf "https://github.com"
force_orphan: true git clone https://github.com/${TARGET_REPO}.git target_repo
cd target_repo
git checkout main
cp -r ../docs/_build/html/* ./
git add .
if [[ -n "$(git status --porcelain)" ]]; then
# If there are changes, commit and push
git commit -m "Update docs"
git push https://github.com/${TARGET_REPO}.git main
else
echo "No changes detected, skipping commit and push."
fi
#!/bin/bash
cd docs
pip install -r requirements.txt
make html
cp CNAME _build/html/
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment