-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (126 loc) · 5.25 KB
/
deploy-docs.yaml
File metadata and controls
146 lines (126 loc) · 5.25 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
name: 📚 Publish Documentation
on:
push:
branches: [main]
workflow_dispatch:
workflow_call:
permissions:
id-token: write
contents: read
jobs:
publish-docs:
environment: production
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Configure AWS credentials
if: ${{ !env.ACT }}
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
- name: Install dependencies
run: npm install
- name: Install PlantUML
run: |
sudo apt-get install -y graphviz
wget -q https://github.com/plantuml/plantuml/releases/download/v1.2026.2/plantuml-1.2026.2.jar -O /opt/plantuml.jar
echo '#!/bin/sh' | sudo tee /usr/local/bin/plantuml
echo 'exec java -jar /opt/plantuml.jar "$@"' | sudo tee -a /usr/local/bin/plantuml
sudo chmod +x /usr/local/bin/plantuml
- name: Generate PlantUML diagrams
run: |
find . -name "*.puml" -print0 | while IFS= read -r -d '' f; do
dir=$(dirname "$f")
base=$(basename "$f")
(cd "$dir" && plantuml -tsvg "$base")
echo "Generated: ${f%.puml}.svg"
done
- name: Verify SVG output
run: |
echo "Generated SVG files:"
find . -name "*.svg" -path "*/images/*"
missing=0
for puml in $(find . -name "*.puml"); do
svg="${puml%.puml}.svg"
if [ ! -f "$svg" ]; then
echo "MISSING: $svg"
missing=1
fi
done
if [ "$missing" -eq 1 ]; then exit 1; fi
- name: Download OpenAPI specs
run: |
mkdir -p public/openapi
curl -sSf "https://raw.githubusercontent.com/BrentIO/FireFly-Controller/main/Controller/openapi.yaml" \
-o public/openapi/controller-openapi.yaml
curl -sSf "https://raw.githubusercontent.com/BrentIO/FireFly-Controller/main/Hardware-Registration-and-Configuration/openapi.yaml" \
-o public/openapi/controller-hardware-registration-and-configuration-openapi.yaml
curl -sSf "https://raw.githubusercontent.com/BrentIO/FireFly-Cloud/main/docs/openapi.yaml" \
-o public/openapi/cloud-openapi.yaml
curl -sSf "https://raw.githubusercontent.com/BrentIO/FireFly-Client/main/Hardware-Registration-and-Configuration/openapi.yaml" \
-o public/openapi/client-hardware-registration-and-configuration-openapi.yaml
- name: Download AsyncAPI specs
run: |
mkdir -p public/asyncapi
curl -sSf "https://raw.githubusercontent.com/BrentIO/FireFly-Controller/main/Controller/asyncapi.yaml" \
-o public/asyncapi/controller-asyncapi.yaml
curl -sSf "https://raw.githubusercontent.com/BrentIO/FireFly-Client/main/Client/asyncapi.yaml" \
-o public/asyncapi/client-asyncapi.yaml
- name: Copy AsyncAPI web component bundle
run: |
cp node_modules/@asyncapi/web-component/lib/asyncapi-web-component.js public/asyncapi/web-component.js
cp node_modules/@asyncapi/react-component/styles/default.min.css public/asyncapi/default.min.css
- name: Copy static assets to public for direct URL access
run: |
find . \( -name "*.svg" -o -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -o -name "*.gif" -o -name "*.webp" \) \
-not -path "./public/*" \
-not -path "./node_modules/*" \
-not -path "./.vitepress/*" | while read -r asset; do
dest="public/${asset#./}"
mkdir -p "$(dirname "$dest")"
cp "$asset" "$dest"
done
- name: Build with VitePress
env:
CONFIGURATOR_URL: https://${{ vars.CONFIGURATOR_DOMAIN_NAME || 'localhost' }}
run: npm run docs:build
- name: Sync to S3
if: ${{ !env.ACT }}
run: aws s3 sync .vitepress/dist/ s3://${{ secrets.S3_DOCS_BUCKET_NAME }} --delete
- name: Set Content-Type for STL files
if: ${{ !env.ACT }}
run: |
aws s3 cp s3://${{ secrets.S3_DOCS_BUCKET_NAME }}/ s3://${{ secrets.S3_DOCS_BUCKET_NAME }}/ \
--recursive \
--exclude "*" \
--include "*.stl" \
--content-type "model/stl" \
--metadata-directive REPLACE
- name: Look up CloudFront distribution ID
if: ${{ !env.ACT }}
id: lookup-dist
run: |
DIST_ID=$(aws cloudformation describe-stacks \
--stack-name firefly-cloudfront-docs \
--query "Stacks[0].Outputs[?OutputKey=='DistributionId'].OutputValue" \
--output text)
echo "dist_id=$DIST_ID" >> $GITHUB_OUTPUT
- name: Invalidate CloudFront cache
if: ${{ !env.ACT }}
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ steps.lookup-dist.outputs.dist_id }} \
--paths "/*"