From 09cea275b7ac2fd46d2184d84524ee1c3ddcbe60 Mon Sep 17 00:00:00 2001 From: hermes-explorigin Date: Sun, 30 Aug 2026 19:03:38 +0000 Subject: [PATCH] Fix WebDAV deploy: DELETE-then-PUT to bypass stale-file cache The serving layer caches uploaded files, so a plain PUT over the existing index.html returned 201 but kept serving the old copy, failing the verify step. Delete first, then PUT (single-line curls: YAML block scalars don't process backslash continuations). --- .gitea/workflows/deploy.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 607dc95..a0d85e9 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -73,11 +73,12 @@ jobs: echo "::error::Add them under Settings → Actions → Secrets, then re-run this job." exit 1 fi - curl -sS --fail \ - -u "$WEBDAV_USER:$WEBDAV_PASS" \ - -X PUT -T dist/index.html \ - -H 'Content-Type: text/html' \ - "$WEBDAV_URL" + # DELETE-then-PUT: the serving layer caches uploaded files, so a plain + # PUT over an existing file returns 201 but keeps serving the OLD copy. + # Deleting first guarantees the new build is actually served. (Each curl + # is a single line -- YAML block scalars don't convert backslash-nl.) + curl -sS -u "$WEBDAV_USER:$WEBDAV_PASS" -X DELETE "$WEBDAV_URL" || echo "(DELETE returned non-zero; file may not exist yet -- continuing)" + curl -sS --fail -u "$WEBDAV_USER:$WEBDAV_PASS" -X PUT -T dist/index.html -H 'Content-Type: text/html' "$WEBDAV_URL" echo "Published to $WEBDAV_URL" # Pull the freshly uploaded file back and compare it to our build, so a