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).
This commit is contained in:
parent
38f0c04b3e
commit
09cea275b7
@ -73,11 +73,12 @@ jobs:
|
|||||||
echo "::error::Add them under Settings → Actions → Secrets, then re-run this job."
|
echo "::error::Add them under Settings → Actions → Secrets, then re-run this job."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
curl -sS --fail \
|
# DELETE-then-PUT: the serving layer caches uploaded files, so a plain
|
||||||
-u "$WEBDAV_USER:$WEBDAV_PASS" \
|
# PUT over an existing file returns 201 but keeps serving the OLD copy.
|
||||||
-X PUT -T dist/index.html \
|
# Deleting first guarantees the new build is actually served. (Each curl
|
||||||
-H 'Content-Type: text/html' \
|
# is a single line -- YAML block scalars don't convert backslash-nl.)
|
||||||
"$WEBDAV_URL"
|
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"
|
echo "Published to $WEBDAV_URL"
|
||||||
|
|
||||||
# Pull the freshly uploaded file back and compare it to our build, so a
|
# Pull the freshly uploaded file back and compare it to our build, so a
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user