Skip to content

Commit

Permalink
Update minify.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
wdhdev committed Nov 13, 2024
1 parent dd794c2 commit e2ef92b
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/minify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ jobs:
run: |
if [ -f list/public_suffix_list.dat ]; then
echo "Old file exists"
echo "old_file_exists=yes" >> $GITHUB_ENV
echo "old_file_exists=true" >> $GITHUB_ENV
else
echo "Old file does not exist"
echo "old_file_exists=no" >> $GITHUB_ENV
echo "old_file_exists=false" >> $GITHUB_ENV
fi
- run: echo ${{ env.old_file_exists }}

- name: Backup the old file
if: ${{ env.old_file_exists }} == 'yes'
if: ${{ env.old_file_exists }} == 'true'
run: cp list/public_suffix_list.dat list/public_suffix_list.dat.old

- name: Download public_suffix_list.dat
Expand All @@ -50,25 +52,27 @@ jobs:
git diff --exit-code list/public_suffix_list.dat list/public_suffix_list.dat.old
if [ $? -eq 0 ]; then
echo "No changes in the file"
echo "changed=no" >> $GITHUB_ENV
echo "changed=false" >> $GITHUB_ENV
else
echo "Changes detected in the file"
echo "changed=yes" >> $GITHUB_ENV
echo "changed=true" >> $GITHUB_ENV
fi
else
echo "Old file does not exist"
echo "changed=yes" >> $GITHUB_ENV
echo "changed=true" >> $GITHUB_ENV
fi
- run: echo ${{ env.changed }}

- name: Minify PSL
if: ${{ env.changed }} == 'yes'
if: ${{ env.changed }} == 'true'
run: |
OUTPUT=$(node scripts/minify.js)
echo "${OUTPUT}"
echo "minify_percent=${OUTPUT}" >> $GITHUB_ENV
- name: Commit
if: ${{ env.changed }} == 'yes'
if: ${{ env.changed }} == 'true'
env:
MINIFY_PERCENT: ${{ env.minify_percent }}
run: |
Expand Down

0 comments on commit e2ef92b

Please sign in to comment.