-
Notifications
You must be signed in to change notification settings - Fork 0
170 lines (148 loc) · 5.55 KB
/
publish-assets.yml
File metadata and controls
170 lines (148 loc) · 5.55 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Build and deploy index.json, llms.txt, and/or llms-full.txt from all product documentation
name: publish-assets
on:
workflow_dispatch:
inputs:
target:
description: 'Asset to publish'
type: choice
options:
- all
- index.json
- llms.txt
- llms-full.txt
default: 'all'
environment:
description: 'Target environment'
type: choice
options:
- prod
- qa
default: 'qa'
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Install Hugo
run: |
curl -LO https://github.com/gohugoio/hugo/releases/download/v0.101.0/hugo_extended_0.101.0_Linux-64bit.deb
sudo dpkg -i hugo_extended_0.101.0_Linux-64bit.deb
- name: Download documentation repositories
run: |
# Each entry is "product_key:ProductName"
# Repo URL pattern: https://github.com/groupdocs-{key}/GroupDocs.{Name}-Docs
PRODUCTS="
annotation:Annotation
assembly:Assembly
classification:Classification
comparison:Comparison
conversion:Conversion
editor:Editor
markdown:Markdown
merger:Merger
metadata:Metadata
parser:Parser
redaction:Redaction
search:Search
signature:Signature
total:Total
viewer:Viewer
watermark:Watermark
"
for entry in $PRODUCTS; do
product="${entry%%:*}"
product_name="${entry##*:}"
repo_url="https://github.com/groupdocs-${product}/GroupDocs.${product_name}-Docs.git"
echo "::group::Downloading ${product} documentation"
echo "Repository: groupdocs-${product}/GroupDocs.${product_name}-Docs"
git clone --depth 1 "${repo_url}" "temp-${product}" 2>&1 || {
echo "::warning::Failed to clone GroupDocs.${product_name}-Docs"
echo "::endgroup::"
continue
}
# Create content directory for this product
mkdir -p "content/${product}"
# Copy product family index page
if [ -f "temp-${product}/_index.md" ]; then
cp "temp-${product}/_index.md" "content/${product}/"
echo "Copied _index.md"
fi
# Copy platform-specific documentation folders
for platform in net java nodejs-java python-net; do
if [ -d "temp-${product}/${platform}" ]; then
cp -r "temp-${product}/${platform}" "content/${product}/"
echo "Copied ${platform}/ folder"
fi
done
# Cleanup cloned repo
rm -rf "temp-${product}"
echo "::endgroup::"
done
echo ""
echo "=== Content structure ==="
ls -la content/
- name: Build site
run: hugo
- name: Verify index.json
if: ${{ inputs.target == 'index.json' || inputs.target == 'all' }}
run: |
if [ ! -f "./public/index.json" ]; then
echo "::error::index.json was not generated"
exit 1
fi
echo "index.json size: $(wc -c < ./public/index.json) bytes"
echo "Number of entries: $(grep -c '"id"' ./public/index.json || echo 0)"
- name: Verify llms.txt
if: ${{ inputs.target == 'llms.txt' || inputs.target == 'all' }}
run: |
if [ ! -f "./public/llms.txt" ]; then
echo "::error::llms.txt was not generated"
exit 1
fi
echo "llms.txt size: $(wc -c < ./public/llms.txt) bytes"
echo "--- llms.txt content ---"
cat ./public/llms.txt
- name: Verify llms-full.txt
if: ${{ inputs.target == 'llms-full.txt' || inputs.target == 'all' }}
run: |
if [ ! -f "./public/llms-full.txt" ]; then
echo "::error::llms-full.txt was not generated"
exit 1
fi
echo "llms-full.txt size: $(wc -c < ./public/llms-full.txt) bytes"
- name: Set deploy target
id: target
run: |
if [[ "${{ inputs.environment }}" == "qa" ]]; then
echo "remote_dir=${{ secrets.DOCS_QA_SSH_DIR }}" >> "$GITHUB_OUTPUT"
else
echo "remote_dir=${{ secrets.DOCS_SSH_DIR }}" >> "$GITHUB_OUTPUT"
fi
- name: Deploy index.json
if: ${{ inputs.target == 'index.json' || inputs.target == 'all' }}
uses: nogsantos/scp-deploy@master
with:
src: ./public/index.json
host: ${{ secrets.DOCS_SSH_HOST }}
remote: ${{ steps.target.outputs.remote_dir }}
user: ${{ secrets.DOCS_SSH_USER }}
key: ${{ secrets.DOCS_SSH_KEY }}
- name: Deploy llms.txt
if: ${{ inputs.target == 'llms.txt' || inputs.target == 'all' }}
uses: nogsantos/scp-deploy@master
with:
src: ./public/llms.txt
host: ${{ secrets.DOCS_SSH_HOST }}
remote: ${{ steps.target.outputs.remote_dir }}
user: ${{ secrets.DOCS_SSH_USER }}
key: ${{ secrets.DOCS_SSH_KEY }}
- name: Deploy llms-full.txt
if: ${{ inputs.target == 'llms-full.txt' || inputs.target == 'all' }}
uses: nogsantos/scp-deploy@master
with:
src: ./public/llms-full.txt
host: ${{ secrets.DOCS_SSH_HOST }}
remote: ${{ steps.target.outputs.remote_dir }}
user: ${{ secrets.DOCS_SSH_USER }}
key: ${{ secrets.DOCS_SSH_KEY }}