Skip to content

Commit 1713745

Browse files
committed
feat(docs-website): add docusaurus and update docs workflows
1 parent ff364db commit 1713745

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+19595
-21
lines changed

.github/workflows/build-and-deploy-site.yml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ name: Build And Deploy Web App
4242

4343
# Trigger conditions for the workflow
4444
on:
45+
release:
46+
types: [published]
4547
workflow_dispatch:
4648

4749
# Concurrency settings to manage multiple workflow runs
@@ -57,9 +59,33 @@ permissions:
5759
pull-requests: write # Write to pull requests
5860

5961
jobs:
60-
build_and_deploy_web:
61-
name: Build And Deploy Web App
62-
uses: openMF/mifos-x-actionhub/.github/workflows/[email protected]
63-
secrets: inherit
64-
with:
65-
web_package_name: 'cmp-web' # <-- Change with your web package name
62+
build_and_deploy_docs_website:
63+
name: Build and Deploy Docusaurus Docs Website
64+
runs-on: ubuntu-latest
65+
steps:
66+
- name: Checkout repository
67+
uses: actions/checkout@v4
68+
with:
69+
fetch-depth: 0
70+
71+
- name: Setup Node.js
72+
uses: actions/setup-node@v4
73+
with:
74+
node-version: '20'
75+
76+
- name: Install dependencies
77+
run: |
78+
cd docs-website
79+
npm ci
80+
81+
- name: Build Docusaurus site
82+
run: |
83+
cd docs-website
84+
npm run build
85+
86+
- name: Deploy to GitHub Pages
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
run: |
90+
cd docs-website
91+
npx docusaurus deploy --skip-build --ci

.github/workflows/docs-generate.yaml

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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
@@ -106,7 +117,7 @@ jobs:
106117
DOCS_DEPLOY_TOKEN: ${{ secrets.DOCS_DEPLOY_TOKEN }}
107118
run: |
108119
if [ -z "$DOCS_DEPLOY_TOKEN" ]; then
109-
echo "⚠️ DOCS_DEPLOY_TOKEN not set. Skipping documentation publishing."
120+
echo "DOCS_DEPLOY_TOKEN not set. Skipping documentation publishing."
110121
echo "To enable publishing, add DOCS_DEPLOY_TOKEN to repository secrets."
111122
exit 0
112123
fi
@@ -132,27 +143,27 @@ jobs:
132143
if git diff --staged --quiet; then
133144
echo "No documentation changes to publish"
134145
else
135-
git commit -m "📚 Update documentation from ${GITHUB_REPOSITORY}@${GITHUB_SHA::7}"
146+
git commit -m "Update documentation from ${GITHUB_REPOSITORY}@${GITHUB_SHA::7}"
136147
git push origin "${DOCS_BRANCH}"
137-
echo "Documentation published successfully!"
148+
echo "Documentation published successfully!"
138149
fi
139150
140151
# Summary
141152
- name: Generate Summary
142153
if: always()
143154
run: |
144-
echo "### 📚 Documentation Generation Summary" >> $GITHUB_STEP_SUMMARY
155+
echo "### Documentation Generation Summary" >> $GITHUB_STEP_SUMMARY
145156
echo "" >> $GITHUB_STEP_SUMMARY
146157
echo "| Component | Status |" >> $GITHUB_STEP_SUMMARY
147158
echo "|-----------|--------|" >> $GITHUB_STEP_SUMMARY
148-
echo "| Dokka (Kotlin API Docs) | Generated |" >> $GITHUB_STEP_SUMMARY
159+
echo "| Dokka (Kotlin API Docs) | Generated |" >> $GITHUB_STEP_SUMMARY
149160
echo "" >> $GITHUB_STEP_SUMMARY
150161
echo "**Commit:** \`${GITHUB_SHA::7}\`" >> $GITHUB_STEP_SUMMARY
151162
echo "**Branch:** \`${GITHUB_REF_NAME}\`" >> $GITHUB_STEP_SUMMARY
152163
153164
if [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/main" ]; then
154165
echo "" >> $GITHUB_STEP_SUMMARY
155-
echo "📦 Documentation artifact uploaded and available for 30 days" >> $GITHUB_STEP_SUMMARY
166+
echo "Documentation artifact uploaded and available for 30 days" >> $GITHUB_STEP_SUMMARY
156167
fi
157168
158169
# Optional: Validate documentation links
@@ -172,13 +183,13 @@ jobs:
172183
- name: Check Documentation Size
173184
run: |
174185
SIZE=$(du -sh docs-output/ | cut -f1)
175-
echo "📊 Documentation size: $SIZE"
186+
echo "Documentation size: $SIZE"
176187
echo "### Documentation Validation" >> $GITHUB_STEP_SUMMARY
177188
echo "Documentation size: **$SIZE**" >> $GITHUB_STEP_SUMMARY
178189
179190
- name: List Generated Files
180191
run: |
181-
echo "### 📁 Generated Files" >> $GITHUB_STEP_SUMMARY
192+
echo "### Generated Files" >> $GITHUB_STEP_SUMMARY
182193
echo '```' >> $GITHUB_STEP_SUMMARY
183194
find docs-output/ -type f | head -20 >> $GITHUB_STEP_SUMMARY
184195
echo '```' >> $GITHUB_STEP_SUMMARY

docs-website/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

docs-website/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Website
2+
3+
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
4+
5+
## Installation
6+
7+
```bash
8+
yarn
9+
```
10+
11+
## Local Development
12+
13+
```bash
14+
yarn start
15+
```
16+
17+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
## Build
20+
21+
```bash
22+
yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
## Deployment
28+
29+
Using SSH:
30+
31+
```bash
32+
USE_SSH=true yarn deploy
33+
```
34+
35+
Not using SSH:
36+
37+
```bash
38+
GIT_USER=<Your GitHub username> yarn deploy
39+
```
40+
41+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
slug: first-blog-post
3+
title: First Blog Post
4+
authors: [slorber, yangshun]
5+
tags: [hola, docusaurus]
6+
---
7+
8+
Lorem ipsum dolor sit amet...
9+
10+
<!-- truncate -->
11+
12+
...consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
slug: long-blog-post
3+
title: Long Blog Post
4+
authors: yangshun
5+
tags: [hello, docusaurus]
6+
---
7+
8+
This is the summary of a very long blog post,
9+
10+
Use a `<!--` `truncate` `-->` comment to limit blog post size in the list view.
11+
12+
<!-- truncate -->
13+
14+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
15+
16+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
17+
18+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
19+
20+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
21+
22+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
23+
24+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
25+
26+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
27+
28+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
29+
30+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
31+
32+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
33+
34+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
35+
36+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
37+
38+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
39+
40+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
41+
42+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
43+
44+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
slug: mdx-blog-post
3+
title: MDX Blog Post
4+
authors: [slorber]
5+
tags: [docusaurus]
6+
---
7+
8+
Blog posts support [Docusaurus Markdown features](https://docusaurus.io/docs/markdown-features), such as [MDX](https://mdxjs.com/).
9+
10+
:::tip
11+
12+
Use the power of React to create interactive blog posts.
13+
14+
:::
15+
16+
{/* truncate */}
17+
18+
For example, use JSX to create an interactive button:
19+
20+
```js
21+
<button onClick={() => alert('button clicked!')}>Click me!</button>
22+
```
23+
24+
<button onClick={() => alert('button clicked!')}>Click me!</button>
93.9 KB
Loading
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
slug: welcome
3+
title: Welcome
4+
authors: [slorber, yangshun]
5+
tags: [facebook, hello, docusaurus]
6+
---
7+
8+
[Docusaurus blogging features](https://docusaurus.io/docs/blog) are powered by the [blog plugin](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog).
9+
10+
Here are a few tips you might find useful.
11+
12+
<!-- truncate -->
13+
14+
Simply add Markdown files (or folders) to the `blog` directory.
15+
16+
Regular blog authors can be added to `authors.yml`.
17+
18+
The blog post date can be extracted from filenames, such as:
19+
20+
- `2019-05-30-welcome.md`
21+
- `2019-05-30-welcome/index.md`
22+
23+
A blog post folder can be convenient to co-locate blog post images:
24+
25+
![Docusaurus Plushie](./docusaurus-plushie-banner.jpeg)
26+
27+
The blog supports tags as well!
28+
29+
**And if you don't want a blog**: just delete this directory, and use `blog: false` in your Docusaurus config.

docs-website/blog/authors.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
yangshun:
2+
name: Yangshun Tay
3+
title: Ex-Meta Staff Engineer, Co-founder GreatFrontEnd
4+
url: https://linkedin.com/in/yangshun
5+
image_url: https://github.com/yangshun.png
6+
page: true
7+
socials:
8+
x: yangshunz
9+
linkedin: yangshun
10+
github: yangshun
11+
newsletter: https://www.greatfrontend.com
12+
13+
slorber:
14+
name: Sébastien Lorber
15+
title: Docusaurus maintainer
16+
url: https://sebastienlorber.com
17+
image_url: https://github.com/slorber.png
18+
page:
19+
# customize the url of the author page at /blog/authors/<permalink>
20+
permalink: '/all-sebastien-lorber-articles'
21+
socials:
22+
x: sebastienlorber
23+
linkedin: sebastienlorber
24+
github: slorber
25+
newsletter: https://thisweekinreact.com

0 commit comments

Comments
 (0)