diff --git a/.github/workflows/ci-build-site.yml b/.github/workflows/ci-build-site.yml index 19627f16..5692ccb3 100644 --- a/.github/workflows/ci-build-site.yml +++ b/.github/workflows/ci-build-site.yml @@ -80,8 +80,6 @@ jobs: -e DO_NOT_MINIFY_HUGO=true \ radio-t/site:previous - # Copy the generated manifest.json from the old build - cp ${{ steps.set-dirs.outputs.old_dir }}/hugo/data/manifest.json ${{ steps.set-dirs.outputs.old_dir }}/manifest.json # chown everything to the calling user as otherwise it's not possible to change it with sed and prettier later sudo chown -R $USER:$USER ${{ steps.set-dirs.outputs.old_dir }}/public @@ -102,8 +100,6 @@ jobs: -e DO_NOT_MINIFY_HUGO=true \ radio-t/site:current - # Copy the generated manifest.json from the new build - cp ${{ steps.set-dirs.outputs.new_dir }}/hugo/data/manifest.json ${{ steps.set-dirs.outputs.new_dir }}/manifest.json # chown everything to the calling user as otherwise it's not possible to change it with sed and prettier later sudo chown -R $USER:$USER ${{ steps.set-dirs.outputs.new_dir }}/public @@ -125,35 +121,10 @@ jobs: sed -i 's#.*##' ${{ steps.set-dirs.outputs.old_dir }}/public/podcast-archives.rss sed -i 's#.*##' ${{ steps.set-dirs.outputs.new_dir }}/public/podcast-archives.rss - - name: Copy New Manifest and Retrieve Old Manifest + - name: Remove hashes from CSS and JS files references run: | - # Define paths to old and new manifests - old_manifest="${{ steps.set-dirs.outputs.old_dir }}/manifest.json" - new_manifest="${{ steps.set-dirs.outputs.new_dir }}/manifest.json" - - set -x - - # Compare manifest.json files and handle ID replacements if they differ - if cmp -s "$old_manifest" "$new_manifest"; then - echo "No differences in manifest.json. Skipping ID replacements." - exit 0 - fi - - # Extract and replace differing IDs - while IFS= read -r old_line && IFS= read -r new_line <&3; do - if [[ "$old_line" != "$new_line" ]]; then - # Extract ID from both lines - old_id=$(echo "$old_line" | grep -oP 'id=\K[^"]+') - new_id=$(echo "$new_line" | grep -oP 'id=\K[^"]+') - - # Perform replacement if IDs differ - if [[ -n "$old_id" && -n "$new_id" && "$old_id" != "$new_id" ]]; then - find ${{ steps.set-dirs.outputs.new_dir }}/public -name '*.html' -exec sed -i "s?id=$new_id?id=$old_id?g" {} + - fi - fi - done <"$old_manifest" 3<"$new_manifest" - - sex +x + find ${{ steps.set-dirs.outputs.old_dir }}/public -type f -exec sed -i 's/\(js\|css\)?id=[^"']\+//g' {} + + find ${{ steps.set-dirs.outputs.new_dir }}/public -type f -exec sed -i 's/\(js\|css\)?id=[^"']\+//g' {} + - name: Generate diff run: | diff --git a/hugo/data/manifest.json b/hugo/data/manifest.json deleted file mode 100644 index 38212f54..00000000 --- a/hugo/data/manifest.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "/app.js": "/app.js?id=183b4e021b78d8707680", - "/app.css": "/app.css?id=dee8b4e8733d44d4c26f", - "/app-dark.css": "/app-dark.css?id=1fe24aeaaea2678b2115", - "/vendor.css": "/vendor.css?id=39509e059daafec80061", - "/vendor-dark.css": "/vendor-dark.css?id=72c5f82e4d133c1555cf", - "/manifest.js": "/manifest.js?id=3c768977c2574a34506e", - "/vendor.js": "/vendor.js?id=5739b2456672d5d7affe", - "/images/icons-sprite.svg": "/images/icons-sprite.svg?id=0a38998db079325220ba" -}