parent
5022c4bb50
commit
4fbb6ecf5d
2 changed files with 51 additions and 23 deletions
@ -0,0 +1,48 @@ |
||||
name: Publish Docs |
||||
|
||||
on: |
||||
push: |
||||
branches: [main] |
||||
workflow_dispatch: |
||||
|
||||
jobs: |
||||
publish-docs: |
||||
runs-on: macos-14 |
||||
steps: |
||||
- name: Git config |
||||
run: | |
||||
git config --global user.name "UltralyticsAssistant" |
||||
git config --global user.email "web@ultralytics.com" |
||||
- name: Checkout Repository |
||||
uses: actions/checkout@v4 |
||||
with: |
||||
repository: ${{ github.repository }} |
||||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }} |
||||
ref: ${{ github.ref }} |
||||
fetch-depth: 0 |
||||
- name: Set up Python |
||||
uses: actions/setup-python@v5 |
||||
with: |
||||
python-version: "3.x" |
||||
cache: "pip" # caching pip dependencies |
||||
- name: Install Dependencies |
||||
run: pip install ruff black tqdm mkdocs-material "mkdocstrings[python]" mkdocs-jupyter mkdocs-redirects mkdocs-ultralytics-plugin mkdocs-macros-plugin |
||||
- name: Build Docs |
||||
run: | |
||||
export JUPYTER_PLATFORM_DIRS=1 |
||||
python docs/build_docs.py |
||||
- name: Publish Docs to https://docs.ultralytics.com |
||||
run: | |
||||
git clone https://github.com/ultralytics/docs.git docs-repo |
||||
cd docs-repo |
||||
git checkout gh-pages || git checkout -b gh-pages |
||||
rm -rf * |
||||
cp -R ../site/* . |
||||
echo "${{ secrets.INDEXNOW_KEY_DOCS }}" > "${{ secrets.INDEXNOW_KEY_DOCS }}.txt" |
||||
git add . |
||||
if git diff --staged --quiet; then |
||||
echo "No changes to commit" |
||||
else |
||||
LATEST_HASH=$(git rev-parse --short=7 HEAD) |
||||
git commit -m "Update Docs for 'ultralytics $LATEST_HASH'" |
||||
git push https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/ultralytics/docs.git gh-pages |
Loading…
Reference in new issue