Skip to content

Commit 9b6c1c9

Browse files
committed
git: clean up workflow
1 parent d1146e6 commit 9b6c1c9

File tree

1 file changed

+74
-8
lines changed

1 file changed

+74
-8
lines changed

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

Lines changed: 74 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ on:
66
workflow_dispatch: # Allow manual triggering for testing
77

88
jobs:
9-
process-formal-spec:
10-
name: "Process Formal Spec Update"
9+
download-artifacts:
10+
name: "Download Formal Spec Artifacts"
1111
runs-on: ubuntu-latest
1212
outputs:
13-
spec_updated: "true"
13+
artifacts-available: ${{ steps.check-artifacts.outputs.available }}
14+
download-successful: ${{ steps.validate-download.outputs.successful }}
1415
steps:
1516
- name: 📥 Checkout repository
1617
uses: actions/checkout@v4
1718

18-
# Try to download directly from GitHub API to see artifacts in the formal-spec repo
19-
- name: List available artifacts in formal-spec repo
19+
- name: 🔍 List available artifacts in formal-spec repo
2020
id: list_artifacts
2121
run: |
2222
echo "Checking for artifacts in formal-spec repo..."
@@ -64,7 +64,8 @@ jobs:
6464
search_artifacts: true
6565
if_no_artifact_found: warn
6666

67-
- name: Check download and create placeholder if needed
67+
- name: ✅ Validate download and create placeholder if needed
68+
id: validate-download
6869
run: |
6970
mkdir -p formal-spec-html
7071
@@ -73,11 +74,44 @@ jobs:
7374
echo "Using downloaded formal spec HTML"
7475
echo "Files in formal-spec-html directory:"
7576
ls -la formal-spec-html/
77+
echo "successful=true" >> $GITHUB_OUTPUT
7678
else
7779
echo "No formal spec HTML available, creating placeholder"
7880
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
81+
echo "successful=false" >> $GITHUB_OUTPUT
7982
fi
8083
84+
- name: 🔍 Check artifacts availability
85+
id: check-artifacts
86+
run: |
87+
if [ -d "formal-spec-html" ] && [ -n "$(ls -A formal-spec-html/ 2>/dev/null)" ]; then
88+
echo "available=true" >> $GITHUB_OUTPUT
89+
else
90+
echo "available=false" >> $GITHUB_OUTPUT
91+
fi
92+
93+
- name: 📤 Upload artifacts for next job
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: formal-spec-html-processed
97+
path: formal-spec-html/
98+
retention-days: 1
99+
100+
process-documentation:
101+
name: "Process and Enhance Documentation"
102+
runs-on: ubuntu-latest
103+
needs: download-artifacts
104+
if: needs.download-artifacts.outputs.artifacts-available == 'true'
105+
steps:
106+
- name: 📥 Checkout repository
107+
uses: actions/checkout@v4
108+
109+
- name: 📥 Download artifacts from previous job
110+
uses: actions/download-artifact@v4
111+
with:
112+
name: formal-spec-html-processed
113+
path: formal-spec-html
114+
81115
- name: 🛠️ Setup Node.js
82116
uses: actions/setup-node@v4
83117
with:
@@ -108,18 +142,50 @@ jobs:
108142
NODE_OPTIONS="--max-old-space-size=4096" npx agda-web-docs-lib process ./static/formal-spec ./agda-docs.config.json
109143
fi
110144
145+
- name: 📤 Upload processed documentation
146+
uses: actions/upload-artifact@v4
147+
with:
148+
name: enhanced-formal-spec
149+
path: site/static/formal-spec/
150+
retention-days: 1
151+
152+
deploy:
153+
name: "Deploy to GitHub Pages"
154+
runs-on: ubuntu-latest
155+
needs: [download-artifacts, process-documentation]
156+
if: always() && (needs.download-artifacts.outputs.artifacts-available == 'true' || needs.download-artifacts.outputs.artifacts-available == 'false')
157+
steps:
158+
- name: 📥 Checkout repository
159+
uses: actions/checkout@v4
160+
161+
- name: 📥 Download enhanced documentation (if available)
162+
if: needs.process-documentation.result == 'success'
163+
uses: actions/download-artifact@v4
164+
with:
165+
name: enhanced-formal-spec
166+
path: deploy-content
167+
continue-on-error: true
168+
169+
- name: 📥 Download basic artifacts (fallback)
170+
if: needs.process-documentation.result != 'success'
171+
uses: actions/download-artifact@v4
172+
with:
173+
name: formal-spec-html-processed
174+
path: deploy-content
175+
continue-on-error: true
176+
111177
- name: 🔧 Configure Git for deployment
112178
run: |
113179
git config --global user.name "github-actions[bot]"
114180
git config --global user.email "github-actions[bot]@users.noreply.github.com"
115181
git config --global http.postBuffer 52428800
116182
git config --global core.compression 1
117183
118-
- name: 🚀 Deploy only formal-spec changes
184+
- name: 🚀 Deploy to GitHub Pages
119185
uses: peaceiris/actions-gh-pages@v4
120186
with:
121187
github_token: ${{ secrets.GITHUB_TOKEN || github.token }}
122-
publish_dir: site/static/formal-spec
188+
publish_dir: deploy-content
123189
destination_dir: formal-spec
124190
cname: leios.cardano-scaling.org
125191
keep_files: true

0 commit comments

Comments
 (0)