Skip to content

Commit 4f696ec

Browse files
authored
Merge pull request #18 from ineka-dev/fix/documentation
Working documentation generation and deployment
2 parents b47360c + a77ea2a commit 4f696ec

File tree

3 files changed

+563
-58
lines changed

3 files changed

+563
-58
lines changed

.github/workflows/docs.yml

+67-57
Original file line numberDiff line numberDiff line change
@@ -4,61 +4,71 @@ on:
44
branches:
55
- main
66
jobs:
7-
# build-and-test:
8-
# name: Build and test project before generating documentation
9-
# runs-on: ubuntu-latest
10-
# steps:
11-
# - uses: actions/checkout@v2
12-
# - name: Use Node.js LTS
13-
# uses: actions/setup-node@v2
14-
# with:
15-
# node-version: lts/*
16-
# - name: Cache node modules
17-
# uses: actions/cache@v2
18-
# env:
19-
# cache-name: cache-node-modules
20-
# with:
21-
# path: ~/.npm
22-
# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
23-
# restore-keys: |
24-
# ${{ runner.os }}-build-${{ env.cache-name }}-
25-
# ${{ runner.os }}-build-
26-
# ${{ runner.os }}-
27-
# - name: Install dependencies
28-
# run: npm ci --prefer-offline
29-
# - name: Build project
30-
# run: npm run build
31-
# - name: Lint project code
32-
# run: npm run lint
7+
build-and-test:
8+
name: Build and lint
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
3312

34-
# build-docs:
35-
# name: Build and deploy documentation
36-
# runs-on: ubuntu-latest
37-
# needs: [build-and-test]
38-
# steps:
39-
# - uses: actions/checkout@v2
40-
# - name: Use Node.js LTS
41-
# uses: actions/setup-node@v2
42-
# with:
43-
# node-version: lts/*
44-
# - name: Cache node modules
45-
# uses: actions/cache@v2
46-
# env:
47-
# cache-name: cache-node-modules
48-
# with:
49-
# path: ~/.npm
50-
# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
51-
# restore-keys: |
52-
# ${{ runner.os }}-build-${{ env.cache-name }}-
53-
# ${{ runner.os }}-build-
54-
# ${{ runner.os }}-
55-
# - name: Install dependencies
56-
# run: npm ci --prefer-offline
57-
# - name: Generate documentation
58-
# run: npm run docs
59-
# - name: Deploy to GitHub Pages
60-
# uses: peaceiris/actions-gh-pages@v3
61-
# with:
62-
# github_token: ${{ secrets.GITHUB_TOKEN }}
63-
# publish_dir: ./docs
64-
# publish_branch: docs
13+
- name: Install pnpm
14+
uses: pnpm/action-setup@v4
15+
with:
16+
version: 9
17+
18+
- name: Use Node.js LTS
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: lts/*
22+
cache: pnpm
23+
24+
- name: Install dependencies
25+
run: pnpm install
26+
27+
- name: Build
28+
run: pnpm build
29+
30+
- name: Lint
31+
run: pnpm lint
32+
33+
build-docs:
34+
name: Build and deploy documentation
35+
runs-on: ubuntu-latest
36+
needs: [build-and-test]
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- name: Install pnpm
41+
uses: pnpm/action-setup@v4
42+
with:
43+
version: 9
44+
45+
- name: Use Node.js LTS
46+
uses: actions/setup-node@v4
47+
with:
48+
node-version: lts/*
49+
cache: pnpm
50+
51+
- name: Install dependencies
52+
run: pnpm install
53+
54+
- name: Generate documentation
55+
run: pnpm docs:generate
56+
57+
- name: Upload GitHub Pages artifact
58+
uses: actions/upload-pages-artifact@v3
59+
with:
60+
path: docs
61+
62+
deploy-docs:
63+
needs: build-docs
64+
permissions:
65+
pages: write
66+
id-token: write
67+
environment:
68+
name: github-pages
69+
url: ${{ steps.deployment.outputs.page_url }}
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: Deploy to GitHub Pages
73+
id: deployment
74+
uses: actions/deploy-pages@v4

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"preinstall": "npx only-allow pnpm",
1919
"dev": "rollup -cw",
2020
"build": "rollup --config rollup.config.ts --configPlugin typescript --environment NODE_ENV:production",
21-
"docs": "typedoc ./src",
21+
"docs:generate": "typedoc",
22+
"docs:serve": "serve docs",
2223
"lint": "eslint . --flag unstable_ts_config",
2324
"lint:fix": "eslint . --fix --flag unstable_ts_config",
2425
"release:publish": "changeset publish",
@@ -38,6 +39,7 @@
3839
"rollup": "^4.21.0",
3940
"rollup-plugin-dts": "^6.1.1",
4041
"rollup-plugin-esbuild": "^6.1.1",
42+
"serve": "^14.2.3",
4143
"tslib": "^2.6.3",
4244
"typedoc": "^0.26.6",
4345
"typescript": "~5.5.4"

0 commit comments

Comments
 (0)