Repository navigation
134 lines (112 loc) Β· 4.18 KB
/
Copy pathdeploy-docs.yml
File metadata and controls
134 lines (112 loc) Β· 4.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Deploy Documentation
on:
push:
branches: [ master ]
# Allow manual triggering
workflow_dispatch:
jobs:
deploy-docs:
runs-on: ubuntu-latest
# Only run on pushes to master (not PRs)
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
- name: Install main dependencies
run: yarn install
- name: Install Angular dependencies
run: |
cd angular
yarn install
- name: Build Angular library
run: yarn build:ng
- name: Build main library
run: |
grunt
webpack
tsc --project tsconfig.docs.json --stripInternal
- name: Generate all documentation
run: yarn doc
- name: Prepare deployment structure
run: |
mkdir -p deploy
# Create proper directory structure for GitHub Pages
mkdir -p deploy/doc/html
mkdir -p deploy/angular/doc/html
# Debug: Check what was generated
echo "π Checking generated documentation..."
echo "Main library HTML docs:"
if [ -d "doc/html" ]; then
echo " β doc/html/ exists"
ls -la doc/html/ | head -10
else
echo " β doc/html/ NOT FOUND"
fi
echo "Angular library HTML docs:"
if [ -d "angular/doc/html" ]; then
echo " β angular/doc/html/ exists"
ls -la angular/doc/html/ | head -10
else
echo " β angular/doc/html/ NOT FOUND"
fi
echo "Angular library Markdown docs (should NOT be deployed):"
if [ -d "angular/doc/api" ]; then
echo " β angular/doc/api/ exists (will NOT be copied to deployment)"
ls -la angular/doc/api/ | head -10
else
echo " β angular/doc/api/ does not exist"
fi
# Copy main library HTML documentation
if [ -d "doc/html" ]; then
cp -r doc/html/* deploy/doc/html/
echo "β Copied main library HTML docs"
else
echo "β Warning: Main library HTML docs not found, skipping..."
fi
# Copy Angular library HTML documentation
if [ -d "angular/doc/html" ]; then
cp -r angular/doc/html/* deploy/angular/doc/html/
echo "β Copied Angular library HTML docs"
else
echo "β Warning: Angular library HTML docs not found, skipping..."
fi
# Note: Do NOT copy or create index.html at root
# The gh-pages branch has its own index.html that should be preserved
# The keep_files: true option will preserve existing files on gh-pages
# Ensure .nojekyll exists to prevent Jekyll processing
touch deploy/.nojekyll
# Final verification
echo ""
echo "π¦ Deployment structure:"
find deploy -type f -name "*.html" | head -20
- name: Preserve gh-pages root index.html
run: |
# Fetch gh-pages to get existing index.html if we didn't create one
if [ ! -f "deploy/index.html" ]; then
echo "π No index.html in deploy, fetching from gh-pages..."
git fetch origin gh-pages:gh-pages 2>/dev/null || true
# Check out just the index.html from gh-pages if it exists
if git show origin/gh-pages:index.html > /dev/null 2>&1; then
git show origin/gh-pages:index.html > deploy/index.html
echo "β Preserved existing index.html from gh-pages"
else
echo "βΉ No index.html on gh-pages to preserve"
fi
else
echo "βΉ index.html already in deploy directory, not fetching from gh-pages"
fi
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./deploy
# Force clean deployment - creates orphan branch to remove ALL old files
force_orphan: true
commit_message: 'Deploy documentation from ${{ github.sha }}'