feat: revalidate frontend cache after PB push, remove root config_path

- Added 'Revalidate Frontend Cache' step that calls /api/revalidate
  with the synced script slugs after successful PocketBase push
- Removed root-level config_path from payload (now inside install_methods)
- Requires FRONTEND_URL and REVALIDATE_SECRET secrets
This commit is contained in:
CanbiZ (MickLesk)
2026-04-14 14:58:52 +02:00
parent 36a4635772
commit e7f33b6586

View File

@@ -204,7 +204,6 @@ jobs:
website: data.website,
logo: data.logo,
description: data.description,
config_path: data.config_path,
default_user: (data.default_credentials && data.default_credentials.username) || data.default_user || null,
default_passwd: (data.default_credentials && data.default_credentials.password) || data.default_passwd || null,
notes: data.notes || [],
@@ -250,3 +249,22 @@ jobs:
})().catch(e => { console.error(e); process.exit(1); });
ENDSCRIPT
shell: bash
- name: Revalidate Frontend Cache
if: steps.changed.outputs.count != '0'
env:
FRONTEND_URL: ${{ secrets.FRONTEND_URL }}
REVALIDATE_SECRET: ${{ secrets.REVALIDATE_SECRET }}
run: |
if [[ -z "$FRONTEND_URL" || -z "$REVALIDATE_SECRET" ]]; then
echo "FRONTEND_URL or REVALIDATE_SECRET not set, skipping revalidation."
exit 0
fi
SLUGS=$(cat changed_app_jsons.txt | xargs -I{} basename {} .json | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "Revalidating tags: scripts, categories — slugs: $SLUGS"
curl -sf -X POST "${FRONTEND_URL}/api/revalidate" \
-H "Authorization: Bearer ${REVALIDATE_SECRET}" \
-H "Content-Type: application/json" \
-d "{\"tags\":[\"scripts\",\"categories\"],\"slugs\":${SLUGS}}" \
&& echo "Cache revalidated." \
|| echo "Warning: revalidation failed (non-critical)."