-
Notifications
You must be signed in to change notification settings - Fork 404
119 lines (117 loc) 路 3.79 KB
/
Copy pathdeploy_sphinx_docs.yml
File metadata and controls
119 lines (117 loc) 路 3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Deploy Sphinx documentation to Pages
on:
pull_request:
types: [opened, synchronize]
paths:
- "docs/sphinx_doc/**/*"
push:
branches:
- main
tags:
- "*"
workflow_dispatch:
jobs:
pages:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
env:
PROJECT: ${{ github.event.repository.name }}
REPO_OWNER: ${{ github.repository_owner }}
MIN_TAG: v1.4.0
JUICER_API_URL: ${{ vars.JUICER_API_URL }}
steps:
- name: Mount /mnt into workspace (writable)
run: |
set -euxo pipefail
sudo mkdir -p /mnt/repo
sudo chown -R "$USER:$USER" /mnt/repo
mkdir -p "$GITHUB_WORKSPACE/repo"
sudo mount --bind /mnt/repo "$GITHUB_WORKSPACE/repo"
sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE/repo"
ls -ld /mnt/repo "$GITHUB_WORKSPACE/repo"
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
path: repo
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@master
with:
python-version: ${{ matrix.python-version }}
- name: Free disk space
run: |
sudo swapoff -a
sudo rm -f /swapfile
sudo apt-get autoremove -y >/dev/null 2>&1
sudo apt-get autoclean -y >/dev/null 2>&1
sudo rm -rf /usr/local/lib/android >/dev/null 2>&1
sudo apt clean
df -h
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Install dependencies with uv
working-directory: repo
run: |
uv pip install --system --upgrade pip
uv pip install --system -e .[all]
- name: Check disk
run: |
set -euxo pipefail
df -h
- name: Fetch Data-Juicer Sphinx Template
working-directory: repo
run: |
set -e
echo "Cloning sphinx template..."
git clone --depth=1 https://github.com/datajuicer/data-juicer-sphinx.git /tmp/template
uv pip install --system -e /tmp/template
if [ -d "docs/sphinx_doc/source" ]; then
echo "Backing up custom files..."
mkdir -p /tmp/custom_files
cp -r docs/sphinx_doc/source /tmp/custom_files
fi
echo "Applying template..."
rm -rf docs/sphinx_doc
mkdir -p docs
cp -r /tmp/template/docs/sphinx_doc docs/
echo "Restoring custom files..."
cp -rf /tmp/custom_files/source/* docs/sphinx_doc/source
echo "Done!"
df -h
- name: Get git tags
working-directory: repo
run: |
git fetch --all --tags
git branch -a
git tag
- id: build
name: Build Documentation
working-directory: repo
run: |
cd docs/sphinx_doc
python build_versions.py --tags
df -h
- name: Redirect index.html
working-directory: repo
run: |
REPOSITORY_OWNER="${GITHUB_REPOSITORY_OWNER}"
cd docs/sphinx_doc
cp ./redirect.html build/index.html
sed -i "s/\[REPOSITORY_OWNER\]/${REPOSITORY_OWNER}/g" build/index.html
sed -i "s/\[PROJECT\]/${PROJECT}/g" build/index.html
cp build/index.html build/404.html
df -h
- name: Upload Documentation
uses: actions/upload-artifact@v4
with:
name: SphinxDoc
path: "repo/docs/sphinx_doc/build"
- uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: "repo/docs/sphinx_doc/build"