Skip to content

Commit cd95562

Browse files
committed
Remove unrelated images from _site before deploying to preview repo
because the whole build result for 20 years of Rubima is too huge, and most of the size is taken up by images.
1 parent 7ba845f commit cd95562

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

.github/workflows/preview.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ jobs:
3434
env:
3535
JEKYLL_ENV: production
3636

37+
- name: Remove unrelated contents
38+
run: git diff --name-only origin/master --relative=articles | ruby -nle 'puts $_[%r([0-9]{4}-[0-9]{2}-[0-9]{2}-([0-9]{4}-.+)\.md), 1]' | tr '\n' ',' | ruby -rfileutils -nle 'Dir.chdir("_site/images") { Dir.glob("*").each { FileUtils.rm_r(_1) if File.directory?(_1) && !$_.split(",").include?(_1) } }'
39+
3740
- name: Deploy preview
3841
uses: rossjrw/pr-preview-action@v1
3942
with:

0 commit comments

Comments
 (0)