docs(ci): prepare deployment to cloudflare
Some checks failed
Deploy Sphinx Docs / build-and-deploy (push) Has been cancelled
Some checks failed
Deploy Sphinx Docs / build-and-deploy (push) Has been cancelled
This commit is contained in:
44
.gitea/workflows/deploy-docs.yaml
Normal file
44
.gitea/workflows/deploy-docs.yaml
Normal file
@@ -0,0 +1,44 @@
|
||||
name: Deploy Sphinx Docs
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "docs/**"
|
||||
- "pyproject.toml"
|
||||
paths-ignore:
|
||||
- "**.sh"
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout version
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
|
||||
- name: Setup Python
|
||||
run: uv python install 3.12
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
uv sync --all-groups
|
||||
|
||||
- name: Build Sphinx Documentation
|
||||
run: |
|
||||
cd docs
|
||||
uv run ./build_docs.sh
|
||||
uv run ./build_docs.sh zh_CN
|
||||
mkdir -p ../public
|
||||
mkdir -p ../public/zh_CN
|
||||
cp -r build/html/* ../public/
|
||||
cp -r build/html_zh_CN/* ../public/zh_CN/
|
||||
|
||||
- name: Deploy to Cloudflare Pages
|
||||
uses: cloudflare/wrangler-action@v3
|
||||
with:
|
||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
command: pages deploy public --project-name=primitive-type-pydocs
|
||||
11
docs/build_docs.sh
Executable file
11
docs/build_docs.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
LANG_CODE=$1
|
||||
|
||||
if [ -n "$LANG_CODE" ]; then
|
||||
echo "Building docs for language: $LANG_CODE..."
|
||||
sphinx-build -b html source/ "build/html_$LANG_CODE/" -D language="$LANG_CODE"
|
||||
else
|
||||
echo "Building docs in English (en_US)..."
|
||||
sphinx-build -b html source build/html
|
||||
fi
|
||||
Reference in New Issue
Block a user