From 80f9a37cc03172c7d17336053c61ce1fbf25c306 Mon Sep 17 00:00:00 2001 From: Dmitry Verkhoturov Date: Fri, 1 Nov 2024 23:47:58 +0100 Subject: [PATCH] Ensure file ownership before prettifying public directories --- .github/workflows/ci-build-site.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-build-site.yml b/.github/workflows/ci-build-site.yml index 6e4b9402..ddbbc380 100644 --- a/.github/workflows/ci-build-site.yml +++ b/.github/workflows/ci-build-site.yml @@ -82,6 +82,8 @@ jobs: # 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 - name: Build current version run: | @@ -102,18 +104,19 @@ jobs: # 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 + - name: Install Prettier run: npm install -g prettier - name: Prettify CSS and JS in public directories run: | - # store in a variable because with sudo $PATH is different - prettier_cmd=$(which prettier) - sudo $prettier_cmd --write "${{ steps.set-dirs.outputs.old_dir }}/public/**/*.css" - sudo $prettier_cmd --write "${{ steps.set-dirs.outputs.old_dir }}/public/**/*.js" - sudo $prettier_cmd --write "${{ steps.set-dirs.outputs.new_dir }}/public/**/*.css" - sudo $prettier_cmd --write "${{ steps.set-dirs.outputs.new_dir }}/public/**/*.js" + prettier --write "${{ steps.set-dirs.outputs.old_dir }}/public/**/*.css" + prettier --write "${{ steps.set-dirs.outputs.old_dir }}/public/**/*.js" + prettier --write "${{ steps.set-dirs.outputs.new_dir }}/public/**/*.css" + prettier --write "${{ steps.set-dirs.outputs.new_dir }}/public/**/*.js" - name: Remove itunes:subtitle from RSS feeds before comparison run: |