File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,6 +74,20 @@ netlify-fetch:
7474 git reset --hard -q $(CURRENT_COMMIT )
7575 git clean -fdq
7676
77- netlify-build : netlify-fetch build-prod build-search-index
77+ netlify-build : netlify-fetch build-prod build-search-index purge-cache
7878
79- .PHONY : build-only-dev build-local build-prod build-ui clean netlify-build netlify-fetch
79+ # Purge the bunny.net pull zone cache after a production build so freshly
80+ # deployed content is served instead of stale cached responses. Skipped when
81+ # the bunny.net credentials are not set (e.g. local builds).
82+ purge-cache :
83+ @if [ -n " $$ BUNNY_API_KEY" ] && [ -n " $$ BUNNY_PULL_ZONE_ID" ]; then \
84+ echo " Purging bunny.net pull zone $$ BUNNY_PULL_ZONE_ID" ; \
85+ curl --fail --show-error --silent \
86+ -X POST " https://api.bunny.net/pullzone/$$ BUNNY_PULL_ZONE_ID/purgeCache" \
87+ -H " AccessKey: $$ BUNNY_API_KEY" \
88+ -H " content-type: application/json" ; \
89+ else \
90+ echo " Skipping bunny.net purge (BUNNY_API_KEY / BUNNY_PULL_ZONE_ID not set)" ; \
91+ fi
92+
93+ .PHONY : build-only-dev build-local build-prod build-ui clean netlify-build netlify-fetch purge-cache
You can’t perform that action at this time.
0 commit comments