-
-
Notifications
You must be signed in to change notification settings - Fork 7
118 lines (101 loc) · 3.56 KB
/
deploy-docs.yml
File metadata and controls
118 lines (101 loc) · 3.56 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
name: Deploy Documentation
on:
push:
branches: [ main ]
paths:
- 'codeprism-docs/**'
- 'docs/**'
- '.github/workflows/deploy-docs.yml'
workflow_dispatch:
inputs:
environment:
description: 'Deployment environment'
required: false
default: 'production'
type: choice
options:
- production
- staging
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: deploy-docs-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
build-docs:
name: Build Documentation
runs-on: ubuntu-latest
timeout-minutes: 15
outputs:
artifact-id: ${{ steps.upload.outputs.artifact-id }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: codeprism-docs/package-lock.json
- name: Install dependencies
shell: bash
working-directory: codeprism-docs
run: |
echo "=== Installing Documentation Dependencies ==="
npm ci
echo "✅ Dependencies installed successfully"
- name: Build documentation
shell: bash
working-directory: codeprism-docs
run: |
echo "=== Building Documentation ==="
npm run build
# Verify build output
if [[ -d "build" ]]; then
echo "✅ Documentation build successful"
echo "📁 Build directory contents:"
ls -la build/ | head -10
# Check build size
build_size=$(du -sh build | cut -f1)
echo "📊 Build size: $build_size"
else
echo "❌ Documentation build failed - no build directory"
exit 1
fi
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
id: upload
uses: actions/upload-pages-artifact@v3
with:
path: codeprism-docs/build
deploy-docs:
name: Deploy to GitHub Pages
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: [build-docs]
timeout-minutes: 10
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Verify deployment and generate summary
shell: bash
run: |
echo "=== Documentation Deployment Summary ==="
echo "📚 **Documentation Deployed Successfully**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Environment:** GitHub Pages" >> $GITHUB_STEP_SUMMARY
echo "**URL:** [${{ steps.deployment.outputs.page_url }}](${{ steps.deployment.outputs.page_url }})" >> $GITHUB_STEP_SUMMARY
echo "**Artifact ID:** \`${{ needs.build-docs.outputs.artifact-id }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Deployment Details:**" >> $GITHUB_STEP_SUMMARY
echo "- Build completed at: \`$(date -u '+%Y-%m-%d %H:%M:%S UTC')\`" >> $GITHUB_STEP_SUMMARY
echo "- Commit: \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "> Documentation is now live and accessible to users!" >> $GITHUB_STEP_SUMMARY
echo "✅ Documentation deployed successfully to: ${{ steps.deployment.outputs.page_url }}"