Skip to content

Commit 836dbb9

Browse files
committed
♻️ Change to reuse the document operation reusable workflow at the document CI/CD workflows.
1 parent 457b940 commit 836dbb9

File tree

2 files changed

+60
-102
lines changed

2 files changed

+60
-102
lines changed

.github/workflows/docs-build-check.yaml

Lines changed: 34 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,27 @@ on:
77
- ".github/workflows/docs-build-check.yaml"
88
- ".github/workflows/documentation.yaml"
99
# Documentation dependencies
10-
- "docs/package.json"
11-
- "docs/pnpm-lock.yaml"
10+
- "docs_with_docusarus/package.json"
11+
- "docs_with_docusarus/pnpm-lock.yaml"
1212
# Docusaurus configuration
13-
- "docs/docusaurus.config.ts"
14-
- "docs/tsconfig.json"
13+
- "docs_with_docusarus/docusaurus.config.ts"
14+
- "docs_with_docusarus/tsconfig.json"
1515
# Documentation content
16-
- "docs/**/*.md"
17-
- "docs/**/*.mdx"
18-
- "docs/**/*.ts"
19-
- "docs/**/*.tsx"
20-
- "docs/**/*.js"
21-
- "docs/**/*.jsx"
22-
- "docs/**/*.css"
23-
- "docs/**/*.json"
16+
- "docs_with_docusarus/**/*.md"
17+
- "docs_with_docusarus/**/*.mdx"
18+
- "docs_with_docusarus/**/*.ts"
19+
- "docs_with_docusarus/**/*.tsx"
20+
- "docs_with_docusarus/**/*.js"
21+
- "docs_with_docusarus/**/*.jsx"
22+
- "docs_with_docusarus/**/*.css"
23+
- "docs_with_docusarus/**/*.json"
2424
# Docusaurus versioning
25-
- "docs/*_versions.json"
26-
- "docs/*_versioned_docs/**"
27-
- "docs/*_versioned_sidebars/**"
25+
- "docs_with_docusarus/*_versions.json"
26+
- "docs_with_docusarus/*_versioned_docs/**"
27+
- "docs_with_docusarus/*_versioned_sidebars/**"
2828
# Static assets
29-
- "docs/static/**"
30-
- "docs/src/**"
29+
- "docs_with_docusarus/static/**"
30+
- "docs_with_docusarus/src/**"
3131

3232
permissions:
3333
contents: read
@@ -38,63 +38,29 @@ concurrency:
3838
cancel-in-progress: true
3939

4040
jobs:
41-
build_docs:
42-
name: Build Documentation
41+
build_and_test_docs:
42+
name: Build & Test Documentation
43+
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_docusaurus_operations.yaml@master
44+
with:
45+
operation: test
46+
node-version: '22'
47+
working-directory: docs_with_docusarus
48+
upload-artifacts: true
49+
50+
validate_build:
51+
name: Validate Build Quality
52+
needs: build_and_test_docs
4353
runs-on: ubuntu-latest
44-
4554
steps:
46-
- name: Checkout repository
47-
uses: actions/checkout@v5
48-
with:
49-
fetch-depth: 1 # Shallow clone for build check
50-
51-
- name: Install pnpm
52-
uses: pnpm/action-setup@v4
55+
- name: Download build artifacts
56+
uses: actions/download-artifact@v6
5357
with:
54-
version: 10
55-
run_install: false
56-
57-
- name: Setup Node.js
58-
uses: actions/setup-node@v6
59-
with:
60-
node-version: '22'
61-
cache: 'pnpm'
62-
cache-dependency-path: docs/pnpm-lock.yaml
63-
64-
- name: Install dependencies
65-
working-directory: ./docs
66-
run: pnpm install --frozen-lockfile
67-
68-
# - name: Type check
69-
# working-directory: ./docs
70-
# run: pnpm typecheck
71-
72-
- name: Build documentation
73-
working-directory: ./docs
74-
run: pnpm build
75-
76-
- name: Check build output
77-
run: |
78-
if [ ! -d "docs/build" ]; then
79-
echo "❌ Build directory not found!"
80-
exit 1
81-
fi
82-
83-
if [ ! -f "docs/build/index.html" ]; then
84-
echo "❌ Main index.html not generated!"
85-
exit 1
86-
fi
87-
88-
# Check for common build artifacts
89-
BUILD_SIZE=$(du -sh docs/build | cut -f1)
90-
echo "✅ Documentation built successfully!"
91-
echo "📁 Build size: $BUILD_SIZE"
92-
echo "📄 Files generated: $(find docs/build -type f | wc -l)"
58+
name: documentation-build
59+
path: docs_with_docusarus/build
9360

9461
- name: Validate build quality
9562
run: |
96-
# Check for broken links in build output (basic validation)
97-
cd docs/build
63+
cd docs_with_docusarus/build
9864
9965
# Count HTML files
10066
HTML_COUNT=$(find . -name "*.html" | wc -l)

.github/workflows/documentation.yaml

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
5959
- name: Download docs update flag from release workflow
6060
if: github.event_name == 'workflow_run'
61-
uses: actions/download-artifact@v5
61+
uses: actions/download-artifact@v6
6262
with:
6363
name: release-docs-flag
6464
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -90,51 +90,43 @@ jobs:
9090
echo "should_deploy=false" >> $GITHUB_OUTPUT
9191
fi
9292
93-
deploy_documentation:
94-
runs-on: ubuntu-latest
95-
# Run based on the check_docs_changes job output (which handles both push and workflow_run events)
93+
build_documentation:
94+
name: Build Documentation
9695
if: needs.check_docs_changes.outputs.should_deploy == 'true'
9796
needs: [check_docs_changes]
98-
steps:
99-
- name: Checkout
100-
uses: actions/checkout@v5
101-
with:
102-
fetch-depth: 0
97+
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_docusaurus_operations.yaml@master
98+
with:
99+
operation: build
100+
node-version: '22'
101+
working-directory: docs_with_docusarus
102+
upload-artifacts: true
103103

104-
# Setup pnpm first
105-
- name: Install pnpm
106-
uses: pnpm/action-setup@v4
107-
with:
108-
version: 10
109-
run_install: false
110-
111-
# Then setup Node.js with pnpm cache
112-
- name: Setup Node.js
113-
uses: actions/setup-node@v6
104+
deploy_to_github_pages:
105+
name: Deploy to GitHub Pages
106+
runs-on: ubuntu-latest
107+
if: needs.check_docs_changes.outputs.should_deploy == 'true'
108+
needs: [check_docs_changes, build_documentation]
109+
steps:
110+
- name: Download build artifacts
111+
uses: actions/download-artifact@v6
114112
with:
115-
node-version: '22'
116-
cache: 'pnpm'
117-
cache-dependency-path: docs_with_docusarus/pnpm-lock.yaml
118-
119-
- name: Install dependencies
120-
working-directory: docs_with_docusarus
121-
run: pnpm install --no-frozen-lockfile
122-
123-
- name: Build website
124-
working-directory: docs_with_docusarus
125-
run: pnpm build
113+
name: documentation-build
114+
path: ./docs_with_docusarus/build
126115

127-
# Setup Pages
128116
- name: Setup Pages
129117
uses: actions/configure-pages@v5
130118

131-
# Upload artifact
132-
- name: Upload artifact
119+
- name: Upload Pages artifact
133120
uses: actions/upload-pages-artifact@v4
134121
with:
135122
path: ./docs_with_docusarus/build
136123

137-
# Deploy to GitHub Pages
138124
- name: Deploy to GitHub Pages
139125
id: deployment
140126
uses: actions/deploy-pages@v4
127+
128+
- name: Deployment summary
129+
run: |
130+
echo "## 📚 Documentation Deployment" >> $GITHUB_STEP_SUMMARY
131+
echo "✅ Successfully deployed to GitHub Pages" >> $GITHUB_STEP_SUMMARY
132+
echo "🔗 **URL**: ${{ steps.deployment.outputs.page_url }}" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)