@@ -20,26 +20,49 @@ jobs:
2020 runs-on : ubuntu-latest
2121 steps :
2222 - name : Checkout source repository
23- uses : actions/checkout@v4
23+ uses : actions/checkout@v5
2424 with :
2525 path : source-repo
2626
2727 - name : Checkout docs repository
28- uses : actions/checkout@v4
28+ uses : actions/checkout@v5
2929 with :
3030 repository : unraid/docs
3131 path : docs-repo
3232 token : ${{ secrets.DOCS_PAT_UNRAID_BOT }}
3333
34- - name : Copy updated docs
34+ - name : Copy and process docs
3535 run : |
3636 if [ ! -d "source-repo/api/docs" ]; then
3737 echo "Source directory does not exist!"
3838 exit 1
3939 fi
40+
41+ # Remove old API docs but preserve other folders
4042 rm -rf docs-repo/docs/API/
4143 mkdir -p docs-repo/docs/API
44+
45+ # Copy all markdown files and maintain directory structure
4246 cp -r source-repo/api/docs/public/. docs-repo/docs/API/
47+
48+ # Copy images to Docusaurus static directory
49+ mkdir -p docs-repo/static/img/api
50+
51+ # Copy images from public/images if they exist
52+ if [ -d "source-repo/api/docs/public/images" ]; then
53+ cp -r source-repo/api/docs/public/images/. docs-repo/static/img/api/
54+ fi
55+
56+ # Also copy any images from the parent docs/images directory
57+ if [ -d "source-repo/api/docs/images" ]; then
58+ cp -r source-repo/api/docs/images/. docs-repo/static/img/api/
59+ fi
60+
61+ # Update image paths in markdown files
62+ # Replace relative image paths with absolute paths pointing to /img/api/
63+ find docs-repo/docs/API -name "*.md" -type f -exec sed -i 's|!\[\([^]]*\)\](\./images/\([^)]*\))||g' {} \;
64+ find docs-repo/docs/API -name "*.md" -type f -exec sed -i 's|!\[\([^]]*\)\](images/\([^)]*\))||g' {} \;
65+ find docs-repo/docs/API -name "*.md" -type f -exec sed -i 's|!\[\([^]]*\)\](../images/\([^)]*\))||g' {} \;
4366 - name : Create Pull Request
4467 uses : peter-evans/create-pull-request@v7
4568 with :
5376 Changes were automatically generated from api/docs/* directory.
5477
5578 @coderabbitai ignore
56- reviewers : ljm42, elibosley, pujitm, mdatelle
79+ reviewers : ljm42, elibosley
5780 branch : update-api-docs
5881 base : main
5982 delete-branch : true
0 commit comments