-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (65 loc) · 2.11 KB
/
redocly_and_publish.yml
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
name: Generate html from yml docs and publish to pages
on:
push:
branches:
- main
jobs:
generate_docs:
name: Generate HTML Docs
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Check for .yml files
run: |
if ls ./*.yml dispoAPI/*.yml 1> /dev/null 2>&1; then
echo "YAML files found."
else
echo "No YAML files found. Exiting."
exit 1
fi
- name: Install Node.js
uses: actions/[email protected]
- name: Install Redocly CLI
run: npm install -g @redocly/cli
- name: Generate HTML files
run: |
# Generate HTML for YAML files in root directory
for file in ./*.yml; do
if [ -f "$file" ]; then
output_html="${file%.*}.html"
redocly build-docs -o "$output_html" "$file"
fi
done
# Generate HTML for YAML files in dispoAPI directory
for file in dispoAPI/*.yml; do
if [ -f "$file" ]; then
output_html="dispoAPI/index.html"
redocly build-docs -o "$output_html" "$file"
fi
done
- name: Add noIndex Meta Tag
run: |
for file in ./*.html dispoAPI/*.html; do
if [ -f "$file" ]; then
echo "Found HTML file: $file"
if sed -i '/<head>/a <meta name="robots" content="noindex">' "$file"; then
echo "Added meta tag to $file successfully."
else
echo "Failed to add meta tag to $file."
fi
fi
done
shell: bash
- name: Set up Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
- name: Deploy to GitHub Pages
uses: JamesIves/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: . # Root folder where HTML files are located