File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3737 pip install sphinx sphinx-rtd-theme sphinx-autodoc-typehints nbsphinx
3838 pip install -e .
3939
40+ - name : Check if docs exist
41+ id : check_docs
42+ run : |
43+ if [ -d "docs" ] && [ -f "docs/conf.py" ] || [ -f "docs/source/conf.py" ]; then
44+ echo "docs_exist=true" >> $GITHUB_OUTPUT
45+ else
46+ echo "docs_exist=false" >> $GITHUB_OUTPUT
47+ fi
48+
4049 - name : Build documentation
50+ if : steps.check_docs.outputs.docs_exist == 'true'
4151 run : |
4252 # Create docs directory if it doesn't exist
4353 mkdir -p docs/_build
@@ -48,11 +58,18 @@ jobs:
4858 # Build HTML documentation
4959 cd docs && make html || echo "Documentation build completed with warnings"
5060
61+ - name : Create simple documentation
62+ if : steps.check_docs.outputs.docs_exist == 'false'
63+ run : |
64+ mkdir -p public
65+ cp README.md public/
66+ echo "<html><head><meta http-equiv='refresh' content='0; url=https://github.com/cloudQuant/backtrader#readme'></head></html>" > public/index.html
67+
5168 - name : Upload documentation artifacts
5269 uses : actions/upload-artifact@v4
5370 with :
5471 name : documentation
55- path : docs/_build/html/
72+ path : ${{ steps.check_docs.outputs.docs_exist == 'true' && ' docs/_build/html/' || 'public/' }}
5673 retention-days : 30
5774
5875 deploy-docs :
Original file line number Diff line number Diff line change 1111jobs :
1212 sync :
1313 runs-on : ubuntu-latest
14+ # Only run if SYNC_GITHUB_TOKEN secret is set
15+ if : ${{ secrets.SYNC_GITHUB_TOKEN != '' }}
1416 steps :
1517 - name : Checkout
1618 uses : actions/checkout@v4
Original file line number Diff line number Diff line change 55[ ![ CI Tests] ( https://github.com/cloudQuant/backtrader/actions/workflows/tests.yml/badge.svg?branch=master )] ( https://github.com/cloudQuant/backtrader/actions/workflows/tests.yml )
66[ ![ Python] ( https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue )] ( https://www.python.org/ )
77[ ![ License] ( https://img.shields.io/badge/license-GPL%203.0-green )] ( LICENSE )
8- [ ![ PyPI] ( https://img.shields.io/badge/pypi-v1.9.76.123-orange )] ( https://pypi.org/project/backtrader/ )
98
109[ ![ Code style: flake8] ( https://img.shields.io/badge/code%20style-flake8-black )] ( https://flake8.pycqa.org/ )
1110[ ![ GitHub stars] ( https://img.shields.io/github/stars/cloudQuant/backtrader?style=social )] ( https://github.com/cloudQuant/backtrader/stargazers )
Original file line number Diff line number Diff line change @@ -14,16 +14,17 @@ This guide explains how to set up automatic synchronization between Gitee and Gi
1414 - Select scopes: ` repo ` (full control of private repositories)
1515 - Copy the generated token
1616
17- 2 . Add the token to your Gitee repository secrets / 将令牌添加到 Gitee 仓库密钥
18- - Go to your Gitee repository settings
19- - Navigate to CI/CD → Secret Variables
17+ 2 . Add the token to your repository secrets / 将令牌添加到仓库密钥
18+ - ** For GitHub Actions** : Go to Settings → Secrets and variables → Actions
2019 - Add a new secret named ` SYNC_GITHUB_TOKEN ` with your GitHub token
20+ - Note: The sync workflow will only run if this secret is set
2121
2222### How it works / 工作原理
2323
2424The ` .github/workflows/sync.yml ` workflow will automatically:
2525- Trigger on pushes to master, main, or dev branches
2626- Push all changes to https://github.com/cloudQuant/backtrader.git
27+ - Only run if ` SYNC_GITHUB_TOKEN ` secret is configured
2728
2829## Method 2: Manual Sync Scripts / 方法2:手动同步脚本
2930
You can’t perform that action at this time.
0 commit comments