forked from gridstack/gridstack.js
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (79 loc) · 2.45 KB
/
deploy-docs.yml
File metadata and controls
96 lines (79 loc) · 2.45 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
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
# Copy main library HTML documentation
if [ -d "doc/html" ]; then
cp -r doc/html/* deploy/doc/html/
fi
# Copy Angular library HTML documentation
if [ -d "angular/doc/html" ]; then
cp -r angular/doc/html/* deploy/angular/doc/html/
fi
# Copy redirect index.html to root
if [ -f "doc/index.html" ]; then
cp doc/index.html deploy/
fi
# Ensure .nojekyll exists to prevent Jekyll processing
touch deploy/.nojekyll
# Optional: Add a simple index.html at root if none exists
if [ ! -f "deploy/index.html" ]; then
cat > deploy/index.html << 'EOF'
<!DOCTYPE html>
<html>
<head>
<title>GridStack.js Documentation</title>
<meta http-equiv="refresh" content="0; url=./doc/html/">
</head>
<body>
<h1>GridStack.js Documentation</h1>
<p>Redirecting to <a href="./doc/html/">API Documentation</a>...</p>
</body>
</html>
EOF
fi
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./deploy
keep_files: true
commit_message: 'Deploy documentation from ${{ github.sha }}'