upgrade.sh: auto-bump EVECTION_PWA_CACHE_VERSION on every deploy

The release-notes reminder to manually bump this and restart gunicorn
was easy to miss or forget, leaving installed PWAs on a stale cached
shell/pages after an upgrade that changed static assets. upgrade.sh
now sets it to the deployed tag itself before restarting services, so
there's no manual step and no cache-invalidation window to miss.
install.sh does the same on first install for consistency.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ksmithandClaude Sonnet 5 committed 2026-10-31 12:08:05 -06:00
1 parent b7d9ee672c
commit f2ee793cf8
3 files changed
+18 -8

No files matched your search

+5 -4
View File
@@ -295,6 +295,7 @@ git fetch --tags --force
LATEST_TAG="$(git tag --sort=-creatordate | head -n1)"
git checkout --detach "$LATEST_TAG"
chown -R evection:evection /opt/evection/app
sed -i "s/^EVECTION_PWA_CACHE_VERSION=.*/EVECTION_PWA_CACHE_VERSION=$LATEST_TAG/" .env
sudo -u evection -H /opt/evection/venv/bin/pip install .
sudo -u evection -H env DJANGO_SETTINGS_MODULE=config.settings.prod \
/opt/evection/venv/bin/python manage.py migrate
@@ -311,7 +312,7 @@ git tag v$(date +%Y.%m.%d)
git push --tags
```
Bump `EVECTION_PWA_CACHE_VERSION` in `.env` whenever a release changes cached
static assets (CSS/JS/icons) — it's baked into the service worker's cache name, so
changing it forces every installed PWA to drop its old cache instead of serving
stale assets after the upgrade.
`upgrade.sh` sets `EVECTION_PWA_CACHE_VERSION` in `.env` to the deployed tag on every
run — it's baked into the service worker's cache name, so this forces every installed
PWA to drop its old cache instead of serving stale assets after the upgrade. You don't
need to bump it by hand.