-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (113 loc) · 4.91 KB
/
develop.yml
File metadata and controls
141 lines (113 loc) · 4.91 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
name: Publish dev ontologies and doc in docs/dev
run-name: Publish dev ontologies and doc
on:
push:
branches:
- develop
paths:
- 'ontology/**/*.owl'
- 'ontology/**/*.ttl'
- 'ontology/**/*.rdf'
workflow_dispatch:
permissions:
contents: write
jobs:
generate-dev-documentation:
runs-on: ubuntu-latest
steps:
- name: Checkout develop branch
uses: actions/checkout@v4
with:
ref: develop
fetch-depth: 0
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Python dependencies
run: pip install -r requirements.txt
- name: Generate documentation on develop
run: |
# Clean old dev documentation before generating new ones
echo "Cleaning old dev documentation..."
rm -rf docs/dev
mkdir -p docs/dev
find ontology -type f \( -name "*.owl" -o -name "*.ttl" -o -name "*.rdf" \) | while read ontology_file; do
echo "Processing $ontology_file (development version)"
# Extract relative path from ontology/
# Example: ontology/modules/core/0.1/core.owl -> modules/core/0.1
relative_path="${ontology_file#ontology/}"
# Get directory path (preserves modules/ or demo/)
dir_path=$(dirname "$relative_path")
# Get filename without extension
file_name=$(basename "$ontology_file")
base_name="${file_name%.*}"
# Dev docs preserve full structure: docs/dev/modules/core/0.1/
output_dir="docs/dev/$dir_path"
mkdir -p "$output_dir"
echo " Path: $dir_path"
echo " Ontology name: $base_name"
echo " Output directory: $output_dir"
java -jar tools/widoco-1.4.25.jar \
-ontFile "$ontology_file" \
-outFolder "$output_dir" \
-rewriteAll \
-webVowl \
-licensius
echo "Development documentation generated for $ontology_file in $output_dir"
if [ -f "$output_dir/index-en.html" ]; then
mv "$output_dir/index-en.html" "$output_dir/index.html"
echo "Renamed index-en.html to index.html"
fi
echo "---"
done
# Create 'latest' folders for each module in dev/modules/ and dev/demo/
echo "Creating dev/latest folders..."
for category_dir in docs/dev/*/; do
if [ -d "$category_dir" ]; then
category_name=$(basename "$category_dir")
echo "Processing dev category: $category_name"
# Process each module within the category
for module_dir in "$category_dir"*/; do
if [ -d "$module_dir" ]; then
module_name=$(basename "$module_dir")
# Find the highest version number (semantic versioning)
# Exclude 'latest' folder explicitly
latest_version=$(find "$module_dir" -mindepth 1 -maxdepth 1 -type d -not -name 'latest' | \
grep -E '/[0-9]+\.[0-9]+' | \
sort -V | \
tail -1)
if [ -n "$latest_version" ]; then
echo " Creating dev/latest folder for $category_name/$module_name"
echo " Latest version: $(basename $latest_version)"
# Copy the latest version to 'latest' folder
rm -rf "$module_dir/latest"
cp -r "$latest_version" "$module_dir/latest"
echo " Created: $module_dir/latest"
fi
fi
done
fi
done
# Build index page and copy to dev folder
echo "Building index page for dev..."
python build_index.py docs/dev/index.html
#cp docs/index.html docs/dev/index.html
#echo "Copied index.html to docs/dev/"
- name: Commit and push to main
run: |
cp -r docs/dev /tmp/dev-docs-temp
git checkout main
# Restore the newly generated docs
rm -rf docs/dev
cp -r /tmp/dev-docs-temp docs/dev
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -f docs/dev/
git commit -m "publish dev ontologies [skip ci]"
git push origin main