Skip to content

Commit 46b0d3f

Browse files
committed
fix(ci): resolve Gitea docs deployment and link issues
This commit addresses compatibility issues with Gitea runners and fixes broken links in the deployed documentation. Changes: - **Artifact Compatibility:** Switches to `actions/upload-artifact@v3` and `download-artifact@v3` for Gitea environments, as v4+ and `upload-pages-artifact` are not fully supported on Gitea (GHES). GitHub Pages continues to use the standard pages artifact action. - **Relative Links:** Sets `html_baseurl=""` during the Sphinx build to force relative URLs, ensuring links work correctly when deployed to a subdirectory. - **Deployment Logic:** Updates the Gitea deployment step to handle uncompressed artifacts (removing tar extraction) and ensures the target directory is cleanly recreated with correct permissions (`755`).
1 parent bdbf172 commit 46b0d3f

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

.github/workflows/docs.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,22 @@ jobs:
7575
python -c "import torch; print(f'PyTorch version: {torch.__version__}'); print(f'CUDA available: {torch.cuda.is_available()}')"
7676
7777
- name: Build documentation
78-
run: sphinx-build -b html docs/source docs/build
78+
run: sphinx-build -b html -D html_baseurl="" docs/source docs/build
7979

80-
- name: Upload artifact
81-
if: ${{ !env.ACT }}
80+
- name: Upload artifact for GitHub Pages
81+
if: ${{ !env.ACT && github.server_url == 'https://github.com' }}
8282
uses: actions/upload-pages-artifact@v3
8383
with:
8484
path: ./docs/build
8585

86+
- name: Upload artifact for Gitea
87+
# Use a GHES-compatible version of upload-artifact for Gitea
88+
if: ${{ !env.ACT && github.server_url != 'https://github.com' }}
89+
uses: actions/upload-artifact@v3
90+
with:
91+
name: docs-artifact
92+
path: ./docs/build
93+
8694
# Deploy job for GitHub Pages
8795
deploy-github:
8896
needs: build
@@ -132,20 +140,22 @@ jobs:
132140
sudo update-ca-certificates
133141
134142
- name: Download artifact
135-
uses: actions/download-artifact@v4
143+
# Use a GHES-compatible version of download-artifact
144+
uses: actions/download-artifact@v3
136145
with:
137-
name: github-pages # This is the default artifact name for upload-pages-artifact
146+
name: docs-artifact
138147
path: ./docs-site
139148

140149
- name: Deploy to Gitea docs location
141150
run: |
142151
echo "Deploying documentation to Gitea's special directory..."
143-
# Extract the artifact.tar (created by upload-pages-artifact)
144-
tar -xf ./docs-site/artifact.tar -C ./docs-site
145-
rm ./docs-site/artifact.tar
146-
152+
# upload-artifact@v3 does not create a tarball, so no extraction is needed.
147153
# The '/pages' directory is a mounted volume on the Gitea runner for serving static content.
148154
# Deploy to a subfolder named after the repository
149155
TARGET_DIR="/pages/docs/${{ github.event.repository.name }}"
156+
157+
# Clean, recreate, copy, and set permissions
158+
sudo rm -rf "$TARGET_DIR"
150159
sudo mkdir -p "$TARGET_DIR"
151-
sudo cp -r ./docs-site/* "$TARGET_DIR/"
160+
sudo cp -r ./docs-site/. "$TARGET_DIR/"
161+
sudo chmod -R 755 "$TARGET_DIR"

0 commit comments

Comments
 (0)