diff --git a/.github/workflows/ci-build-site.yml b/.github/workflows/ci-build-site.yml index 603c13ae..f91e6584 100644 --- a/.github/workflows/ci-build-site.yml +++ b/.github/workflows/ci-build-site.yml @@ -48,13 +48,33 @@ jobs: run: | git checkout ${{ steps.get-comparison-commit.outputs.compare_sha }} docker build -t radio-t/site:previous . - docker run --rm -v ${{ github.workspace }}/public-prev:/srv/hugo/public radio-t/site:previous + + # Create directories for previous build + mkdir -p hugo-prev/hugo + cp -r hugo/* hugo-prev/hugo/ + mkdir -p hugo-prev/public + + # Run the container with proper volume mounts + docker run --rm \ + -v ${{ github.workspace }}/hugo-prev/hugo:/srv/hugo \ + -v ${{ github.workspace }}/hugo-prev/public:/srv/hugo/public \ + radio-t/site:previous - name: Build current version run: | git checkout ${{ github.event.pull_request.head.sha || github.sha }} docker build -t radio-t/site:current . - docker run --rm -v ${{ github.workspace }}/public-current:/srv/hugo/public radio-t/site:current + + # Create directories for current build + mkdir -p hugo-current/hugo + cp -r hugo/* hugo-current/hugo/ + mkdir -p hugo-current/public + + # Run the container with proper volume mounts + docker run --rm \ + -v ${{ github.workspace }}/hugo-current/hugo:/srv/hugo \ + -v ${{ github.workspace }}/hugo-current/public:/srv/hugo/public \ + radio-t/site:current - name: Generate diff run: | @@ -62,25 +82,32 @@ jobs: mkdir -p site-diff # Generate diff for HTML files - diff -r -N -u public-prev public-current > site-diff/changes.diff || true + diff -r -N -u hugo-prev/public hugo-current/public > site-diff/changes.diff || true # Generate a summary of changed files echo "Changed files:" > site-diff/summary.txt - find public-current -type f -exec sh -c ' - prev_file="public-prev/${1#public-current/}" + find hugo-current/public -type f -exec sh -c ' + prev_file="hugo-prev/public/${1#hugo-current/public/}" if [ ! -f "$prev_file" ]; then - echo "New: ${1#public-current/}" + echo "New: ${1#hugo-current/public/}" elif ! cmp -s "$1" "$prev_file"; then - echo "Modified: ${1#public-current/}" + echo "Modified: ${1#hugo-current/public/}" fi ' sh {} \; >> site-diff/summary.txt - find public-prev -type f -exec sh -c ' - current_file="public-current/${1#public-prev/}" + find hugo-prev/public -type f -exec sh -c ' + current_file="hugo-current/public/${1#hugo-prev/public/}" if [ ! -f "$current_file" ]; then - echo "Deleted: ${1#public-prev/}" + echo "Deleted: ${1#hugo-prev/public/}" fi ' sh {} \; >> site-diff/summary.txt + + # Add size comparison + echo -e "\nSize comparison:" >> site-diff/summary.txt + echo "Previous build:" >> site-diff/summary.txt + du -sh hugo-prev/public >> site-diff/summary.txt + echo "Current build:" >> site-diff/summary.txt + du -sh hugo-current/public >> site-diff/summary.txt - name: Upload diff artifacts uses: actions/upload-artifact@v4