Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

docs.yml 4.8 KB

You have to be logged in to leave a comment. Sign In
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
120
121
122
123
  1. # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
  2. # Test and publish docs to https://docs.ultralytics.com
  3. # Ignores the following Docs rules to match Google-style docstrings:
  4. # D100: Missing docstring in public module
  5. # D104: Missing docstring in public package
  6. # D203: 1 blank line required before class docstring
  7. # D205: 1 blank line required between summary line and description
  8. # D212: Multi-line docstring summary should start at the first line
  9. # D213: Multi-line docstring summary should start at the second line
  10. # D401: First line of docstring should be in imperative mood
  11. # D406: Section name should end with a newline
  12. # D407: Missing dashed underline after section
  13. # D413: Missing blank line after last section
  14. name: Publish Docs
  15. on:
  16. push:
  17. branches: [main]
  18. pull_request:
  19. branches: [main]
  20. workflow_dispatch:
  21. inputs:
  22. publish_docs:
  23. description: "Publish live to https://docs.ultralytics.com"
  24. default: true
  25. type: boolean
  26. jobs:
  27. Docs:
  28. if: github.repository == 'ultralytics/ultralytics'
  29. runs-on: ubuntu-latest
  30. env:
  31. GITHUB_REF: ${{ github.head_ref || github.ref }}
  32. steps:
  33. - name: Checkout Repository
  34. uses: actions/checkout@v4
  35. with:
  36. # Fetch depth 0 required to capture full docs author history
  37. repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
  38. token: ${{ secrets._GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  39. ref: ${{ env.GITHUB_REF }}
  40. fetch-depth: 0
  41. - name: Set up Python
  42. uses: actions/setup-python@v5
  43. with:
  44. python-version: "3.x"
  45. - uses: astral-sh/setup-uv@v5
  46. - name: Install Dependencies
  47. run: uv pip install --system ruff black tqdm mkdocs-material "mkdocstrings[python]" mkdocs-ultralytics-plugin mkdocs-macros-plugin
  48. - name: Ruff fixes
  49. continue-on-error: true
  50. run: |
  51. ruff check \
  52. --fix \
  53. --unsafe-fixes \
  54. --extend-select I,D,UP \
  55. --target-version py38 \
  56. --ignore D100,D104,D203,D205,D212,D213,D401,D406,D407,D413 \
  57. .
  58. - name: Update Docs Reference Section and Push Changes
  59. continue-on-error: true
  60. run: |
  61. git config --global user.name "UltralyticsAssistant"
  62. git config --global user.email "web@ultralytics.com"
  63. python docs/build_reference.py
  64. git pull origin "$GITHUB_REF"
  65. git add .
  66. git reset HEAD -- .github/workflows/ # workflow changes are not permitted with default token
  67. if [[ "${{ github.event_name }}" == "pull_request" ]] && ! git diff --staged --quiet; then
  68. git commit -m "Auto-update Ultralytics Docs Reference by https://ultralytics.com/actions"
  69. git push
  70. else
  71. echo "No changes to commit"
  72. fi
  73. - name: Ruff checks
  74. run: |
  75. ruff check \
  76. --extend-select I,D,UP \
  77. --target-version py38 \
  78. --ignore D100,D104,D203,D205,D212,D213,D401,D406,D407,D413 \
  79. .
  80. - name: Build Docs and Check for Warnings
  81. run: |
  82. export JUPYTER_PLATFORM_DIRS=1
  83. python docs/build_docs.py
  84. - name: Commit and Push Docs changes
  85. continue-on-error: true
  86. if: always()
  87. run: |
  88. git pull origin "$GITHUB_REF"
  89. git add --update # only add updated files
  90. git reset HEAD -- .github/workflows/ # workflow changes are not permitted with default token
  91. if [[ "${{ github.event_name }}" == "pull_request" ]] && ! git diff --staged --quiet; then
  92. git commit -m "Auto-update Ultralytics Docs by https://ultralytics.com/actions"
  93. git push
  94. else
  95. echo "No changes to commit"
  96. fi
  97. - name: Publish Docs to https://docs.ultralytics.com
  98. if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_docs == 'true')
  99. run: |
  100. git clone --depth 1 --branch gh-pages https://github.com/ultralytics/docs.git docs-repo
  101. cd docs-repo
  102. if [ -f "vercel.json" ]; then
  103. cp vercel.json /tmp/vercel.json
  104. fi
  105. rm -rf *
  106. cp -R ../site/* .
  107. if [ -f "/tmp/vercel.json" ]; then
  108. cp /tmp/vercel.json .
  109. fi
  110. echo "${{ secrets.INDEXNOW_KEY_DOCS }}" > "${{ secrets.INDEXNOW_KEY_DOCS }}.txt"
  111. git add .
  112. if git diff --staged --quiet; then
  113. echo "No changes to commit"
  114. else
  115. git pull origin gh-pages
  116. LATEST_HASH=$(git rev-parse --short=7 HEAD)
  117. git commit -m "Update Docs for 'ultralytics ${{ steps.check_pypi.outputs.version }} - $LATEST_HASH'"
  118. git push https://${{ secrets._GITHUB_TOKEN }}@github.com/ultralytics/docs.git gh-pages
  119. fi
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...