Skip to content

Commit 1e5e3e5

Browse files
authored
fix(deploy): use lines[-1] for wrapper CID + add version to summary (#86)
PR #85 took lines[-2] from the IPFS gateway response, copying aleph-cloud-app's pattern. But their tree shape differs: they prefix paths with `out/` so lines[-2] gives them the served root inside an extra wrapper. Our flat paths produce one wrapper at lines[-1] and random sub-directories at earlier indices — the last deploy was serving from a sub-directory, so HTML loaded but nested asset paths (/_next/static/...) 404'd, breaking all styling. Also adds CURRENT_VERSION (extracted from src/changelog.ts in the workflow) to the deploy summary so the deployed version is visible without inspecting the build.
1 parent 8cdc4af commit 1e5e3e5

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ jobs:
3232
env:
3333
NEXT_PUBLIC_API_URL: https://rust-scheduler.aleph.im
3434

35+
- name: Extract version
36+
id: version
37+
run: |
38+
VERSION=$(grep -E '^export const CURRENT_VERSION' src/changelog.ts | sed -E 's/.*"([^"]+)".*/\1/')
39+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
40+
3541
- name: Setup Python
3642
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
3743
with:
@@ -63,6 +69,7 @@ jobs:
6369
6470
| | |
6571
|---|---|
72+
| **Version** | \`v${{ steps.version.outputs.version }}\` |
6673
| **CID** | \`${{ steps.upload.outputs.cid }}\` |
6774
| **Gateway** | https://${{ steps.upload.outputs.cid }}.ipfs.aleph.sh/ |
6875
EOF

scripts/deploy-ipfs.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,14 @@ def upload_directory_to_ipfs(directory: Path) -> str:
7979
)
8080
resp.raise_for_status()
8181

82-
# The wrapping directory is the second-to-last entry in the streamed
83-
# response (last is the wrapper's parent — same hash).
82+
# We upload with flat paths (relative to `directory`), so the gateway
83+
# produces one wrapper directory containing all files. That wrapper is
84+
# the LAST entry in the streamed response. (aleph-cloud-app uses
85+
# `lines[-2]` because they prefix paths with `out/`, putting the
86+
# served root one level deeper inside an extra wrapper — different
87+
# tree shape, different index.)
8488
lines = resp.text.strip().splitlines()
85-
cid = json.loads(lines[-2]).get("Hash") if len(lines) >= 2 else None
89+
cid = json.loads(lines[-1]).get("Hash") if lines else None
8690

8791
if not cid:
8892
print("ERROR: No CID found in IPFS gateway response")

0 commit comments

Comments
 (0)