@@ -13,93 +13,105 @@ jobs:
1313
1414 release-job :
1515 runs-on : ubuntu-latest
16- outputs :
17- released : ${{ steps.main.outputs.released }}
1816 steps :
19- - uses : actions/checkout@v4
17+ - name : Checkout repository
18+ uses : actions/checkout@v4
2019 with :
2120 fetch-depth : 0
22- - uses : actions/setup-node@v4
21+
22+ - name : Setup Node.js
23+ uses : actions/setup-node@v4
2324 with :
2425 node-version-file : " .nvmrc"
2526 cache : " npm"
26- - id : main
27+
28+ - name : Install Dependencies and Release
29+ id : main
2730 run : |
2831 npm ci
2932 npm run release
30- if [ -d "dist/" ]; then
31- echo "released=true" >> "$GITHUB_OUTPUT"
32-
33- npm run typedoc
34-
35- # Remove any unnecessary files or directories that might contain symlinks or large files
36- rm -rf examples/node_modules
37- find examples -name "* alias" -delete
38-
39- # Replace symbolic link with actual files
40- # Remove the symbolic link to dist
41- rm -rf examples/dist
42- # Copy the actual dist content to examples/dist
43- cp -r dist examples/dist
4433
45- # Copy only the required content to the docs folder
46- mkdir -p docs
47- cp -r dist/* docs/
48- cp -r examples docs/
49-
50- # Delete any remaining symbolic links and macOS aliases under the docs directory
51- find docs -type l -delete
52- find docs -name "* alias" -delete
34+ # Check if release was successful (dist directory exists)
35+ if [ ! -d "dist/" ]; then
36+ echo "Release did not create dist directory, running build..."
37+ npm run build
5338 fi
5439 env :
5540 NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
5641 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
57- - if : steps.main.outputs.released == 'true'
58- name : Validate docs directory before upload
59- run : |
60- echo "Checking for symbolic links..."
61- if find docs -type l | grep -q .; then
62- echo "Error: Symbolic links found in docs directory"
63- find docs -type l
64- exit 1
65- fi
6642
67- echo "Checking directory size..."
68- DOCS_SIZE=$(du -sb docs | cut -f1 2>/dev/null || echo "0")
69- if [ "$DOCS_SIZE" = "0" ]; then
70- # Fallback for systems without -b option (like macOS)
71- DOCS_SIZE_KB=$(du -sk docs | cut -f1)
72- DOCS_SIZE=$((DOCS_SIZE_KB * 1024))
73- fi
74- MAX_SIZE=$((1024*1024*1024*8)) # 8GB limit to be safe
75- if [ "$DOCS_SIZE" -gt "$MAX_SIZE" ]; then
76- echo "Error: docs directory is too large (${DOCS_SIZE} bytes)"
77- exit 1
78- fi
43+ - name : Generate documentation
44+ run : npm run typedoc
7945
80- echo "docs directory size: $(du -sh docs)"
81- echo "docs directory is ready for upload"
46+ - name : Upload dist artifact
47+ uses : actions/upload-artifact@v4
48+ with :
49+ name : dist
50+ path : dist/
8251
83- - if : steps.main.outputs.released == 'true'
52+ - name : Upload docs artifact
8453 uses : actions/upload-artifact@v4
8554 with :
86- name : github-pages
87- path : ./ docs
55+ name : typedoc-docs
56+ path : docs/
8857
89- # See: https://github.com/actions/deploy-pages
9058 deploy-job :
9159 needs : release-job
92- if : needs.release-job.outputs.released == 'true'
60+ runs-on : ubuntu-latest
9361 permissions :
62+ contents : read
9463 pages : write
9564 id-token : write
9665 environment :
9766 name : github-pages
9867 url : ${{ steps.deployment.outputs.page_url }}
99- runs-on : ubuntu-latest
10068 steps :
69+ - name : Checkout repository
70+ uses : actions/checkout@v4
71+ with :
72+ fetch-depth : 0
73+
74+ - name : Download dist artifact
75+ uses : actions/download-artifact@v4
76+ with :
77+ name : dist
78+ path : dist/
79+
80+ - name : Download typedoc docs artifact
81+ uses : actions/download-artifact@v4
82+ with :
83+ name : typedoc-docs
84+ path : docs/
85+
86+ - name : Prepare examples directory
87+ run : |
88+ # Remove the alias to dist (if it exists)
89+ find examples -name "* alias" -delete
90+ find examples -name "dist" -type l -delete
91+ rm -rf examples/dist
92+
93+ # Copy the actual dist content to examples/dist
94+ cp -r dist examples/dist
95+
96+ - name : Prepare docs directory
97+ run : |
98+ # Copy examples to docs directory
99+ cp -r examples docs/
100+
101+ # Delete any remaining symbolic links and macOS aliases under the docs directory
102+ find docs -type l -delete
103+ find docs -name "* alias" -delete
104+ find docs -type l -delete
105+
101106 - name : Setup Pages
102107 uses : actions/configure-pages@v5
108+
109+ - name : Upload to GitHub Pages
110+ uses : actions/upload-pages-artifact@v3
111+ with :
112+ name : github-pages
113+ path : ./docs
114+
103115 - name : Deploy to GitHub Pages
104116 id : deployment
105117 uses : actions/deploy-pages@v4
0 commit comments