-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
42 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,17 @@ jobs: | |
-v ${{ github.workspace }}/${{ steps.set-dirs.outputs.old_dir }}/public:/srv/hugo/public \ | ||
radio-t/site:previous | ||
- name: Remove versioned hashes from old files | ||
run: | | ||
# Remove hashes for CSS, JS, and other assets based on manifest.json mappings | ||
for path in /app.js /app.css /app-dark.css /vendor.css /vendor-dark.css; do | ||
hash=$(grep "\"$path\"" manifest.json | grep -oP 'id=\K[^"]+') | ||
if [ -n "$hash" ]; then | ||
# Apply sed to both old and new build directories | ||
sed -i "s|$path?id=$hash|$path|g" ${{ steps.set-dirs.outputs.old_dir }}/public/**/*.html | ||
fi | ||
done | ||
- name: Build current version | ||
run: | | ||
git checkout ${{ github.event.pull_request.head.sha || github.sha }} | ||
|
@@ -87,6 +98,16 @@ jobs: | |
-v ${{ github.workspace }}/${{ steps.set-dirs.outputs.new_dir }}/public:/srv/hugo/public \ | ||
radio-t/site:current | ||
- name: Remove versioned hashes from new files | ||
run: | | ||
# Remove hashes for CSS, JS, and other assets based on manifest.json mappings | ||
for path in /app.js /app.css /app-dark.css /vendor.css /vendor-dark.css; do | ||
hash=$(grep "\"$path\"" manifest.json | grep -oP 'id=\K[^"]+') | ||
if [ -n "$hash" ]; then | ||
sed -i "s|$path?id=$hash|$path|g" ${{ steps.set-dirs.outputs.new_dir }}/public/**/*.html | ||
fi | ||
done | ||
- name: Remove itunes:subtitle from RSS feeds before comparison | ||
run: | | ||
sed -i 's#<itunes:subtitle>.*</itunes:subtitle>##' ${{ steps.set-dirs.outputs.old_dir }}/public/podcast-archives-short.rss | ||
|
@@ -148,19 +169,22 @@ jobs: | |
PASTEBIN_API_KEY: ${{ secrets.PASTEBIN_API_KEY }} | ||
id: create-pastebin | ||
run: | | ||
diff_content=$(cat changes.diff) | ||
# Use a URL-encoded paste name to handle special characters | ||
paste_name=$(echo "radio-t.com Site Changes for PR #${{ github.event.pull_request.number }}, commit ${{ github.sha }}" | jq -sRr @uri) | ||
# Post the diff file directly from changes.diff | ||
# https://pastebin.com/doc_api | ||
paste_output=$(curl --silent "https://pastebin.com/api/api_post.php" \ | ||
-d "api_dev_key=$PASTEBIN_API_KEY" \ | ||
-d "api_option=paste" \ | ||
-d "api_paste_expire_date=1M" \ | ||
-d "api_paste_format=diff" \ | ||
-d "api_paste_private=0" \ | ||
-d "api_paste_code=${diff_content}" \ | ||
-d "api_paste_name=radio-t.com Site Changes for PR #${{ github.event.pull_request.number }}, commit ${{ github.sha }}") | ||
# Check if the output is a valid URL, otherwise print error | ||
if [[ "$paste_url" == "https://"* ]]; then | ||
-d "api_paste_name=${paste_name}" \ | ||
--data-urlencode "[email protected]" || echo "curl call to pastebin failed") | ||
# Check if the output is a valid URL, otherwise print an error | ||
if [[ "$paste_output" == "https://"* ]]; then | ||
echo "PASTE_URL=$paste_output" >> $GITHUB_ENV | ||
else | ||
echo "Error: Failed to create Pastebin paste: $paste_output" >&2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters