-
Notifications
You must be signed in to change notification settings - Fork 1
132 lines (116 loc) · 4.75 KB
/
deploy.yml
File metadata and controls
132 lines (116 loc) · 4.75 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
name: Deploy Documentation
# ── Triggers ──────────────────────────────────────────────────────────────────
on:
push:
branches: [master]
paths:
- 'apps/**'
- 'packages/**'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- '.github/workflows/deploy.yml'
# Rebuild every Monday 08:00 UTC to refresh GitHub module data
schedule:
- cron: '0 8 * * 1'
# Allow manual trigger from the GitHub UI
workflow_dispatch:
# ── Permissions (required for Pages deployment) ───────────────────────────────
permissions:
contents: read
pages: write
id-token: write
# ── Only one deployment at a time ─────────────────────────────────────────────
concurrency:
group: pages
cancel-in-progress: true
# ── Jobs ──────────────────────────────────────────────────────────────────────
jobs:
build:
name: Build Docs
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v5
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build all docs sites
env:
# Provides 5 000 req/hr GitHub API limit for module ecosystem data
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm build:all
# ── Debug: show what Astro produced ────────────────────────────────────
# Remove this step once the first deploy is confirmed working.
- name: Show dist structure
run: |
echo "=== docs-27/dist ==="
find apps/docs-27/dist -maxdepth 4 -type f | sort | head -30
echo "=== docs-4x/dist ==="
find apps/docs-4x/dist -maxdepth 4 -type f | sort | head -20
# ── Merge both build outputs into one deploy folder ─────────────────────
#
# How Astro 6 static output works with base:
# base: '/xoops-docs/2.7' → files land in dist/xoops-docs/2.7/
# base: '/xoops-docs/4.x' → files land in dist/xoops-docs/4.x/
#
# We strip the leading 'xoops-docs/' so dist-all/ contains 2.7/ and 4.x/.
# GitHub Pages serves the repo at /xoops-docs/, so:
# dist-all/2.7/index.html → https://xoops.github.io/xoops-docs/2.7/
# dist-all/4.x/index.html → https://xoops.github.io/xoops-docs/4.x/
- name: Merge build outputs
run: |
mkdir -p dist-all
# Copy nested base-path content out one level
if [ -d "apps/docs-27/dist/xoops-docs" ]; then
cp -r apps/docs-27/dist/xoops-docs/. dist-all/
else
echo "WARNING: docs-27 dist/xoops-docs not found — falling back to flat copy"
mkdir -p dist-all/2.7
cp -r apps/docs-27/dist/. dist-all/2.7/
fi
if [ -d "apps/docs-4x/dist/xoops-docs" ]; then
cp -r apps/docs-4x/dist/xoops-docs/. dist-all/
else
echo "WARNING: docs-4x dist/xoops-docs not found — falling back to flat copy"
mkdir -p dist-all/4.x
cp -r apps/docs-4x/dist/. dist-all/4.x/
fi
# Root redirect: /xoops-docs/ → /xoops-docs/2.7/
cat > dist-all/index.html << 'EOF'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="refresh" content="0; url=/xoops-docs/2.7/" />
<title>XOOPS Docs</title>
</head>
<body>
Redirecting to <a href="/xoops-docs/2.7/">XOOPS 2.7 Docs</a>…
</body>
</html>
EOF
echo "=== dist-all layout ==="
find dist-all -maxdepth 3 -type f | sort | head -30
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v5
with:
path: dist-all/
deploy:
name: Deploy to GitHub Pages
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5