Skip to content

Commit f199904

Browse files
committed
fix(ci): merge desktop manifest and R2 cache TTL (anomalyco#174)
2 parents f9b3f58 + 2ddbbf7 commit f199904

4 files changed

Lines changed: 34 additions & 16 deletions

File tree

‎.github/workflows/publish-ellamaka-desktop.yml‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,15 @@ jobs:
234234
*.deb) ct="application/vnd.debian.binary-package" ;;
235235
*.rpm) ct="application/x-rpm" ;;
236236
esac
237-
put_with_cache "$f" "${VERSION_PREFIX}/${name}" "public, max-age=604800" "$ct"
237+
put_with_cache "$f" "${VERSION_PREFIX}/${name}" "public, max-age=2592000" "$ct"
238238
done
239239
240-
put_with_cache "release-output/manifest.json" "${VERSION_PREFIX}/manifest.json" "public, max-age=604800" "application/json"
241-
put_with_cache "release-output/checksums.txt" "${VERSION_PREFIX}/checksums.txt" "public, max-age=604800" "text/plain"
242-
put_with_cache "release-output/release-notes.md" "${VERSION_PREFIX}/release-notes.md" "public, max-age=604800" "text/markdown"
240+
put_with_cache "release-output/manifest.json" "${VERSION_PREFIX}/manifest.json" "public, max-age=2592000" "application/json"
241+
put_with_cache "release-output/checksums.txt" "${VERSION_PREFIX}/checksums.txt" "public, max-age=2592000" "text/plain"
242+
put_with_cache "release-output/release-notes.md" "${VERSION_PREFIX}/release-notes.md" "public, max-age=2592000" "text/markdown"
243+
244+
put_with_cache "release-output/manifest.json" "${LATEST_PREFIX}/manifest.json" "public, max-age=60" "application/json"
245+
echo " uploaded manifest: ${LATEST_PREFIX}/manifest.json"
243246
244247
for f in dist/ellamaka-desktop-*; do
245248
[ -f "$f" ] || continue
@@ -252,12 +255,12 @@ jobs:
252255
case "$name" in
253256
*.zip) ct="application/zip" ;;
254257
esac
255-
put_with_cache "$f" "${LATEST_PREFIX}/${name}" "public, max-age=300" "$ct"
258+
put_with_cache "$f" "${LATEST_PREFIX}/${name}" "public, max-age=60" "$ct"
256259
done
257260
258261
for feed in latest-mac.yml latest.yml latest-linux.yml; do
259262
if [ -f "dist/${feed}" ]; then
260-
put_with_cache "dist/${feed}" "${LATEST_PREFIX}/${feed}" "public, max-age=300" "application/x-yaml"
263+
put_with_cache "dist/${feed}" "${LATEST_PREFIX}/${feed}" "public, max-age=60" "application/x-yaml"
261264
echo " uploaded feed: ${LATEST_PREFIX}/${feed}"
262265
else
263266
echo " WARNING: feed not found, skipping: dist/${feed}"
@@ -331,6 +334,7 @@ jobs:
331334
VERSION_BASE="${CDN_ROOT}/v${VERSION}"
332335
LATEST_BASE="${CDN_ROOT}/latest"
333336
PURGE_URLS=(
337+
"${LATEST_BASE}/manifest.json"
334338
"${LATEST_BASE}/latest-mac.yml"
335339
"${LATEST_BASE}/latest.yml"
336340
"${LATEST_BASE}/latest-linux.yml"

‎.github/workflows/publish-ellamaka.yml‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ jobs:
143143
--recursive \
144144
--endpoint-url "$R2_URL"
145145
146-
# Cache-Control: versioned paths immutable (1 week), latest alias
147-
# short TTL (5 min). CDN purge on release ensures latest is fresh.
146+
# Cache-Control: versioned paths immutable (30 day), latest alias
147+
# short TTL (60 second). CDN purge on release ensures latest is fresh.
148148
put_with_cache() {
149149
local file="$1" key="$2" cache="$3" ct="$4"
150150
aws s3api delete-object \
@@ -170,21 +170,21 @@ jobs:
170170
done
171171
}
172172
173-
# Binary archives (immutable, 1-week cache)
173+
# Binary archives (immutable, 30-day cache)
174174
for f in dist/ellamaka-*.tar.gz dist/ellamaka-*.zip; do
175175
name="$(basename "$f")"
176176
ct="application/octet-stream"
177177
case "$name" in *.tar.gz) ct="application/x-tar";; *.zip) ct="application/zip";; esac
178-
put_with_cache "$f" "${VERSION_PREFIX}/${name}" "public, max-age=604800" "$ct"
178+
put_with_cache "$f" "${VERSION_PREFIX}/${name}" "public, max-age=2592000" "$ct"
179179
done
180180
181-
# Metadata (1-week cache)
182-
put_with_cache "release-output/manifest.json" "${VERSION_PREFIX}/manifest.json" "public, max-age=604800" "application/json"
183-
put_with_cache "release-output/checksums.txt" "${VERSION_PREFIX}/checksums.txt" "public, max-age=604800" "text/plain"
184-
put_with_cache "release-output/release-notes.md" "${VERSION_PREFIX}/release-notes.md" "public, max-age=604800" "text/markdown"
181+
# Metadata (30-day cache)
182+
put_with_cache "release-output/manifest.json" "${VERSION_PREFIX}/manifest.json" "public, max-age=2592000" "application/json"
183+
put_with_cache "release-output/checksums.txt" "${VERSION_PREFIX}/checksums.txt" "public, max-age=2592000" "text/plain"
184+
put_with_cache "release-output/release-notes.md" "${VERSION_PREFIX}/release-notes.md" "public, max-age=2592000" "text/markdown"
185185
186-
# Latest alias: manifest only (short TTL)
187-
put_with_cache "release-output/manifest.json" "ellamaka/latest/manifest.json" "public, max-age=300" "application/json"
186+
# Latest alias: manifest only (60-second TTL)
187+
put_with_cache "release-output/manifest.json" "ellamaka/latest/manifest.json" "public, max-age=60" "application/json"
188188
189189
# Verify: head-object for size first (fast), full download only if
190190
# size mismatches. R2 single PUT can silently truncate; size check

‎packages/ellamaka/test/desktop-release-repair.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ describe("desktop release repair", () => {
3939
expect(workflow).toContain("old-release-urls")
4040
expect(workflow).toContain(".zip.blockmap")
4141
expect(workflow).toContain(".exe.blockmap")
42+
// Latest manifest upload
43+
expect(workflow).toContain('${LATEST_PREFIX}/manifest.json')
44+
// TTL: versioned 30-day, latest 60-second, no legacy values
45+
expect(workflow).toContain("max-age=2592000")
46+
expect(workflow).toContain("max-age=60")
47+
expect(workflow).not.toContain("max-age=604800")
48+
expect(workflow).not.toContain("max-age=300")
49+
// Purge URL includes latest manifest
50+
expect(workflow).toContain('${LATEST_BASE}/manifest.json')
4251
})
4352

4453
test("injects release version and ad-hoc signs macOS", async () => {

‎packages/ellamaka/test/release-workflow.test.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ describe("publish-ellamaka workflow", () => {
5353
expect(workflow).toContain("ellamaka/latest/manifest.json")
5454
expect(workflow).not.toContain("ellamaka/latest/checksums.txt")
5555
expect(workflow).not.toContain("ellamaka/latest/release-notes.md")
56+
// TTL: versioned paths use 30-day cache, latest uses 60-second cache
57+
expect(workflow).toContain("max-age=2592000")
58+
expect(workflow).toContain("max-age=60")
59+
expect(workflow).not.toContain("max-age=604800")
60+
expect(workflow).not.toContain("max-age=300")
5661
})
5762

5863
test("deletes R2 object before put-object to avoid stale truncated residue", () => {

0 commit comments

Comments
 (0)