Skip to content

Commit 9d49005

Browse files
committed
git: split workflows
1 parent 1b15d74 commit 9d49005

File tree

2 files changed

+53
-99
lines changed

2 files changed

+53
-99
lines changed

.github/workflows/docs.yaml

Lines changed: 3 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,6 @@ on:
1414
- "site/**"
1515
- "ui/**"
1616

17-
workflow_run:
18-
workflows: ["Formal Spec Listener"]
19-
types:
20-
- completed
21-
branches:
22-
- main
23-
24-
workflow_dispatch: # Allow manual triggering or via API
25-
inputs:
26-
source:
27-
description: "Source of the workflow dispatch"
28-
required: false
29-
default: "manual"
30-
3117
permissions:
3218
contents: write
3319
pages: write
@@ -195,80 +181,11 @@ jobs:
195181
path: |
196182
site/build/*
197183
198-
build-docusaurus-site-formal-spec:
199-
name: "Build Docusaurus Site (Formal Spec)"
200-
if: github.event_name == 'workflow_run'
201-
runs-on: ubuntu-latest
202-
steps:
203-
- name: 📥 Checkout repository
204-
uses: actions/checkout@v4
205-
with:
206-
fetch-depth: 2
207-
208-
- name: 🛠️ Setup Node.js
209-
uses: actions/setup-node@v4
210-
with:
211-
node-version: 22
212-
cache: "yarn"
213-
cache-dependency-path: ./site/yarn.lock
214-
215-
- name: 📦 Install dependencies
216-
working-directory: site
217-
run: yarn install
218-
219-
# Only for workflow_run: Download formal spec HTML
220-
- name: 📥 Download formal spec HTML
221-
uses: actions/download-artifact@v4
222-
continue-on-error: true
223-
with:
224-
name: formal-spec-html
225-
path: formal-spec-html
226-
227-
# Only for workflow_run: Update formal spec
228-
- name: 📝 Update formal spec
229-
run: |
230-
mkdir -p site/static/formal-spec
231-
if [ -d "formal-spec-html" ] && [ -n "$(ls -A formal-spec-html/ 2>/dev/null)" ]; then
232-
cp -r formal-spec-html/* site/static/formal-spec/
233-
fi
234-
235-
# Only for workflow_run: Enhance Agda documentation
236-
- name: 🔄 Enhance Agda documentation
237-
working-directory: site
238-
timeout-minutes: 25
239-
run: |
240-
HTML_COUNT=$(find ./static/formal-spec -name '*.html' | wc -l)
241-
if [ "$HTML_COUNT" -gt "0" ]; then
242-
NODE_OPTIONS="--max-old-space-size=6144" npx agda-web-docs-lib process ./static/formal-spec ./agda-docs.config.json
243-
fi
244-
245-
- name: 🏗️ Build Docusaurus site
246-
working-directory: site
247-
run: |
248-
yarn build
249-
250-
- name: Verify Docusaurus build
251-
working-directory: site
252-
run: |
253-
if [ -z "$(ls -A build/)" ]; then
254-
echo "Error: Docusaurus build directory is empty"
255-
exit 1
256-
fi
257-
ls -la build/
258-
259-
- name: 🚀 Upload Docusaurus build
260-
uses: actions/upload-artifact@v4
261-
with:
262-
name: docusaurus-build
263-
if-no-files-found: error
264-
path: |
265-
site/build/*
266-
267184
docs-publish:
268-
name: "Publish"
185+
name: "Publish Docs"
186+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
187+
needs: [build-docusaurus-site]
269188
runs-on: ubuntu-latest
270-
needs: [build-docusaurus-site, build-docusaurus-site-formal-spec]
271-
if: always() && (github.ref == 'refs/heads/main' || github.event_name == 'workflow_run')
272189
steps:
273190
- name: 📥 Download Docusaurus build
274191
uses: actions/download-artifact@v4
@@ -277,7 +194,6 @@ jobs:
277194
path: ./github-pages
278195

279196
- name: 🚀 Publish GitHub Pages
280-
if: success()
281197
uses: peaceiris/actions-gh-pages@v4
282198
with:
283199
github_token: ${{ secrets.GITHUB_TOKEN || github.token }}

.github/workflows/formal-spec-listener.yaml

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,56 @@ jobs:
7878
echo "<html><body><h1>Formal Specification</h1><p>Formal specification documentation is being updated. Please check back later.</p></body></html>" > formal-spec-html/index.html
7979
fi
8080
81-
- name: 🚢 Upload formal spec files
82-
uses: actions/upload-artifact@v4
81+
# Prepare Docusaurus site with formal spec
82+
- name: 📥 Checkout repository (again for site)
83+
uses: actions/checkout@v4
8384
with:
84-
name: formal-spec-html
85-
path: formal-spec-html
86-
retention-days: 1
87-
compression-level: 9
88-
if-no-files-found: error
85+
fetch-depth: 2
86+
87+
- name: 🛠️ Setup Node.js
88+
uses: actions/setup-node@v4
89+
with:
90+
node-version: 22
91+
cache: "yarn"
92+
cache-dependency-path: ./site/yarn.lock
93+
94+
- name: 📦 Install dependencies
95+
working-directory: site
96+
run: yarn install
97+
98+
- name: 📝 Update formal spec
99+
run: |
100+
mkdir -p site/static/formal-spec
101+
if [ -d "formal-spec-html" ] && [ -n "$(ls -A formal-spec-html/ 2>/dev/null)" ]; then
102+
cp -r formal-spec-html/* site/static/formal-spec/
103+
fi
89104
90-
- name: Verify artifact upload
105+
- name: 🔄 Enhance Agda documentation
106+
working-directory: site
107+
timeout-minutes: 25
91108
run: |
92-
echo "Verifying artifact upload..."
93-
curl -s -H "Authorization: token ${{ secrets.LEIOS_TRIGGER_PAT }}" \
94-
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" | \
95-
jq '.artifacts[] | {name: .name, id: .id, created_at: .created_at, expired: .expired}'
109+
HTML_COUNT=$(find ./static/formal-spec -name '*.html' | wc -l)
110+
if [ "$HTML_COUNT" -gt "0" ]; then
111+
NODE_OPTIONS="--max-old-space-size=6144" npx agda-web-docs-lib process ./static/formal-spec ./agda-docs.config.json
112+
fi
113+
114+
- name: 🏗️ Build Docusaurus site
115+
working-directory: site
116+
run: |
117+
yarn build
118+
119+
- name: Verify Docusaurus build
120+
working-directory: site
121+
run: |
122+
if [ -z "$(ls -A build/)" ]; then
123+
echo "Error: Docusaurus build directory is empty"
124+
exit 1
125+
fi
126+
ls -la build/
127+
128+
- name: 🚀 Publish GitHub Pages
129+
uses: peaceiris/actions-gh-pages@v4
130+
with:
131+
github_token: ${{ secrets.GITHUB_TOKEN || github.token }}
132+
publish_dir: site/build
133+
cname: leios.cardano-scaling.org

0 commit comments

Comments
 (0)