Skip to content

Commit

Permalink
Improve the diff building
Browse files Browse the repository at this point in the history
  • Loading branch information
paskal committed Nov 1, 2024
1 parent 6ff3530 commit a07e079
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/ci-build-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ jobs:
-v ${{ github.workspace }}/${{ steps.set-dirs.outputs.old_dir }}/hugo:/srv/hugo \
-v ${{ github.workspace }}/${{ steps.set-dirs.outputs.old_dir }}/public:/srv/hugo/public \
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
- name: Build current version
run: |
Expand All @@ -86,6 +90,10 @@ jobs:
-v ${{ github.workspace }}/${{ steps.set-dirs.outputs.new_dir }}/hugo:/srv/hugo \
-v ${{ github.workspace }}/${{ steps.set-dirs.outputs.new_dir }}/public:/srv/hugo/public \
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
- name: Remove itunes:subtitle from RSS feeds before comparison
run: |
Expand All @@ -96,14 +104,6 @@ jobs:
- name: Copy New Manifest and Retrieve Old Manifest
run: |
set -x
# 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
# Check out the old commit to get its manifest.json
git checkout ${{ steps.get-comparison-commit.outputs.compare_sha }} -- hugo/data/manifest.json
mv hugo/data/manifest.json ${{ steps.set-dirs.outputs.old_dir }}/manifest.json
# 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"
Expand Down Expand Up @@ -152,9 +152,9 @@ jobs:
file_path=${1#$new_dir/public/}
prev_file="$old_dir/public/$file_path"
if [ ! -f "$prev_file" ]; then
echo "- New: `$file_path`"
echo "- New: \`$file_path\`"
elif ! cmp -s "$1" "$prev_file"; then
echo "- Modified: `$file_path`"
echo "- Modified: \`$file_path\`"
fi
' sh {} \; >> changes.md
# add line in the beginning of the file only if it's not empty
Expand All @@ -168,7 +168,7 @@ jobs:
file_path=${1#$old_dir/public/}
current_file="$new_dir/public/$file_path"
if [ ! -f "$current_file" ]; then
echo "- Deleted: `$file_path`"
echo "- Deleted: \`$file_path\`"
fi
' sh {} \; >> changes.md
# delete summary if it's empty
Expand Down

0 comments on commit a07e079

Please sign in to comment.