2828 publish :
2929 description : ' Publish documentation to docs repository'
3030 required : false
31- default : ' true'
31+ default : true
3232 type : boolean
3333
3434env :
@@ -74,19 +74,30 @@ jobs:
7474 # Organize documentation
7575 - name : Organize Documentation Output
7676 run : |
77- mkdir -p docs-output
78-
77+ mkdir -p docs-website/static/api
7978 # Copy Dokka documentation
8079 if [ -d "build/dokka" ]; then
8180 echo "Copying Dokka documentation..."
82- cp -r build/dokka/* docs-output /
81+ cp -r build/dokka/* docs-website/static/api /
8382 fi
84-
8583 # Create .nojekyll for GitHub Pages
86- touch docs-output/.nojekyll
87-
84+ touch docs-website/static/api/.nojekyll
8885 echo "Documentation organized successfully!"
89- ls -la docs-output/
86+ ls -la docs-website/static/api/
87+
88+ # Commit and push Dokka docs to docs-website on dev branch
89+ - name : Commit and Push Dokka Docs to docs-website
90+ if : github.ref == 'refs/heads/dev' && github.event_name == 'push'
91+ run : |
92+ git config --global user.name "github-actions[bot]"
93+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
94+ git add docs-website/static/api
95+ if git diff --staged --quiet; then
96+ echo "No documentation changes to commit."
97+ else
98+ git commit -m "docs: update Dokka API docs [skip ci]"
99+ git push origin dev
100+ fi
90101
91102 # Upload documentation as artifact
92103 - name : Upload Documentation Artifact
@@ -96,63 +107,22 @@ jobs:
96107 path : docs-output/
97108 retention-days : 30
98109
99- # Publish to GitHub Pages or docs repository
100- - name : Publish to Documentation Repository
101- if : |
102- github.event_name == 'push' &&
103- github.ref == 'refs/heads/main' &&
104- (github.event.inputs.publish != 'false')
105- env :
106- DOCS_DEPLOY_TOKEN : ${{ secrets.DOCS_DEPLOY_TOKEN }}
107- run : |
108- if [ -z "$DOCS_DEPLOY_TOKEN" ]; then
109- echo "⚠️ DOCS_DEPLOY_TOKEN not set. Skipping documentation publishing."
110- echo "To enable publishing, add DOCS_DEPLOY_TOKEN to repository secrets."
111- exit 0
112- fi
113-
114- # Configure git
115- git config --global user.name "github-actions[bot]"
116- git config --global user.email "github-actions[bot]@users.noreply.github.com"
117-
118- # Clone docs repository
119- git clone "https://x-access-token:${DOCS_DEPLOY_TOKEN}@github.com/${DOCS_REPO}.git" docs-repo
120- cd docs-repo
121- git checkout "${DOCS_BRANCH}" || git checkout -b "${DOCS_BRANCH}"
122-
123- # Clear existing docs and copy new ones
124- rm -rf *
125- cp -r ../docs-output/* .
126-
127- # Create .nojekyll for GitHub Pages
128- touch .nojekyll
129-
130- # Commit and push
131- git add .
132- if git diff --staged --quiet; then
133- echo "No documentation changes to publish"
134- else
135- git commit -m "📚 Update documentation from ${GITHUB_REPOSITORY}@${GITHUB_SHA::7}"
136- git push origin "${DOCS_BRANCH}"
137- echo "✅ Documentation published successfully!"
138- fi
139-
140110 # Summary
141111 - name : Generate Summary
142112 if : always()
143113 run : |
144- echo "### 📚 Documentation Generation Summary" >> $GITHUB_STEP_SUMMARY
114+ echo "### Documentation Generation Summary" >> $GITHUB_STEP_SUMMARY
145115 echo "" >> $GITHUB_STEP_SUMMARY
146116 echo "| Component | Status |" >> $GITHUB_STEP_SUMMARY
147117 echo "|-----------|--------|" >> $GITHUB_STEP_SUMMARY
148- echo "| Dokka (Kotlin API Docs) | ✅ Generated |" >> $GITHUB_STEP_SUMMARY
118+ echo "| Dokka (Kotlin API Docs) | Generated |" >> $GITHUB_STEP_SUMMARY
149119 echo "" >> $GITHUB_STEP_SUMMARY
150120 echo "**Commit:** \`${GITHUB_SHA::7}\`" >> $GITHUB_STEP_SUMMARY
151121 echo "**Branch:** \`${GITHUB_REF_NAME}\`" >> $GITHUB_STEP_SUMMARY
152122
153123 if [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/main" ]; then
154124 echo "" >> $GITHUB_STEP_SUMMARY
155- echo "📦 Documentation artifact uploaded and available for 30 days" >> $GITHUB_STEP_SUMMARY
125+ echo "Documentation artifact uploaded and available for 30 days" >> $GITHUB_STEP_SUMMARY
156126 fi
157127
158128 # Optional: Validate documentation links
@@ -172,13 +142,13 @@ jobs:
172142 - name : Check Documentation Size
173143 run : |
174144 SIZE=$(du -sh docs-output/ | cut -f1)
175- echo "📊 Documentation size: $SIZE"
145+ echo "Documentation size: $SIZE"
176146 echo "### Documentation Validation" >> $GITHUB_STEP_SUMMARY
177147 echo "Documentation size: **$SIZE**" >> $GITHUB_STEP_SUMMARY
178148
179149 - name : List Generated Files
180150 run : |
181- echo "### 📁 Generated Files" >> $GITHUB_STEP_SUMMARY
151+ echo "### Generated Files" >> $GITHUB_STEP_SUMMARY
182152 echo '```' >> $GITHUB_STEP_SUMMARY
183153 find docs-output/ -type f | head -20 >> $GITHUB_STEP_SUMMARY
184154 echo '```' >> $GITHUB_STEP_SUMMARY
0 commit comments