forked from isaac-sim/IsaacLab
-
Notifications
You must be signed in to change notification settings - Fork 1
101 lines (85 loc) · 2.78 KB
/
sync-and-translate.yml
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
name: Sync and Translate Documentation
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
sync-and-translate:
runs-on: ubuntu-latest
steps:
- name: Checkout user's repo (main branch)
uses: actions/checkout@v2
with:
repository: fan-ziqi/IsaacLab
ref: main
- name: Configure git user
run: |
git config --global user.name 'fan-ziqi'
git config --global user.email '[email protected]'
- name: Add upstream repository
run: git remote add upstream https://github.com/isaac-sim/IsaacLab.git
- name: Merge upstream changes while keeping local changes
run: |
git fetch upstream
git checkout main
git merge upstream/main --strategy-option ours --allow-unrelated-histories --verbose
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools polib==1.2.0 openai==v1.3.6 python-dotenv==1.0.0 pytest==8.2.2 sphinx-intl sphinx-book-theme==1.0.1 myst-parser sphinxcontrib-bibtex==2.5.0 autodocsumm sphinx-copybutton sphinx-icon sphinx_design sphinxemoji numpy matplotlib warp-lang gymnasium
- name: Generate gettext
run: |
pushd docs
make gettext
popd
- name: Update translations
run: |
pushd docs
sphinx-intl update -p _build/gettext -l zh_CN
popd
- name: Translate using custom script
run: |
pushd docs
python po_translator.py --folder ./locale --lang zh_CN --folder-language
popd
- name: Build HTML with translations
run: |
pushd docs
make -e SPHINXOPTS="-D language='zh_CN'" html
popd
- name: Copy generated HTML files to temporary Path
run: |
mkdir -p temp_html
cp -r docs/_build/html/* temp_html/
rm -rf docs/_build/html/
- name: Check if po files changed
id: po_files_changed
run: |
git checkout main
git add docs/locale/zh_CN/LC_MESSAGES/**/*.po
git diff-index --quiet HEAD -- || echo "po_changed=true" >> $GITHUB_ENV
- name: Commit and push po files to main branch
run: |
if [ "$po_changed" = "true" ]; then
git commit -m "Update po files"
git push origin main
else
echo "No changes to commit"
fi
- name: Commit and push changes to gh-pages-zhcn branch
run: |
git checkout --orphan gh-pages-zhcn
git rm -rf .
rm -rf docs source
cp -r temp_html/* .
rm -rf temp_html
git add .
git commit -m "Update translated documentation"
git push origin gh-pages-zhcn --force