Skip to content

Commit

Permalink
Test commit to generate changes
Browse files Browse the repository at this point in the history
  • Loading branch information
paskal committed Nov 1, 2024
1 parent 3116775 commit 42bf7c2
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 12 deletions.
36 changes: 30 additions & 6 deletions .github/workflows/ci-build-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:22-alpine as build
FROM node:22-alpine AS build

WORKDIR /app
COPY hugo/package.json hugo/package-lock.json ./
Expand All @@ -14,7 +14,7 @@ COPY ./hugo/layouts /app/layouts/

RUN npm run build

FROM golang:1.22-alpine as go-build
FROM golang:1.22-alpine AS go-build
COPY rss_generator /build
RUN cd /build && go build -o /build/bin/rss_generator -ldflags "-s -w" && ls -la /build/bin/rss_generator

Expand Down
8 changes: 7 additions & 1 deletion exec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@ echo " === copy frontend ==="
cp -rf /app/static/build /srv/hugo/static/
cp -rf /app/data/manifest.json /srv/hugo/data/
echo " === generate pages ==="
hugo --minify
if [ -z "$DO_NOT_MINIMIFY" ]; then
echo " === build with minify ==="
hugo --minify
else
echo " === build without minify ==="
hugo
fi
/usr/local/bin/rss_generator
4 changes: 2 additions & 2 deletions hugo/data/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"/app.js": "/app.js?id=183b4e021b78d8707680",
"/app.css": "/app.css?id=dee8b4e8733d44d4c26f",
"/app-dark.css": "/app-dark.css?id=1fe24aeaaea2678b2115",
"/app.css": "/app.css?id=259beb654fd4ad0ddb10",
"/app-dark.css": "/app-dark.css?id=a83a330925ab3e2a30f5",
"/vendor.css": "/vendor.css?id=39509e059daafec80061",
"/vendor-dark.css": "/vendor-dark.css?id=72c5f82e4d133c1555cf",
"/manifest.js": "/manifest.js?id=3c768977c2574a34506e",
Expand Down
2 changes: 1 addition & 1 deletion hugo/src/scss/_archives.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
content: '';
position: absolute;
bottom: 0;
left: $grid-gutter-width / 2;
left: $grid-gutter-width * 0.3;
right: $grid-gutter-width / 2;
height: 1px;
background-color: $border-color;
Expand Down

0 comments on commit 42bf7c2

Please sign in to comment.