Last active
March 4, 2023 02:26
-
-
Save runspired/aac0f970e4821e201397631dece5aded to your computer and use it in GitHub Desktop.
Parallel Brotli Compression in a Github Actions Workflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ubuntu machines have 2 cores, but larger runners can have a lot more | |
# parallel will auto use number of virtual cores | |
# brotli, and parallel are both available out of the box on github's ubuntu machines | |
jobs: | |
build-assets: | |
steps: | |
- uses: actions/checkout@v3 | |
# - name: Build | |
# some step which creates your `dist` | |
- name: CompressFiles | |
working-directory: dist | |
run: | | |
for v in $(tr ',' '\n' <<< "$FILE_EXT") | |
do | |
find . -maxdepth 4 -type f -name "*.$v" -print | parallel brotli -f -q 11 {} | |
done | |
env: | |
# basically everything but PNG/JPEG,WEBP etc. since images have better per-format compression | |
FILE_EXT: 'js,css,html,svg,txt,json,eot,ttf,woff,woff2,pdf,csv,wasm,mem,res,xod,aspx' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment