Skip to content

Commit 5b445db

Browse files
committed
Add production warning for imgs
1 parent c27934e commit 5b445db

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

.github/workflows/deploy-production.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,20 @@ jobs:
7171
find ./content/hardware -type f -name "*-pinout.png" -exec cp {} ./static/resources/pinouts/ \;
7272
find ./content/hardware -type f -name "*-step.zip" -exec cp {} ./static/resources/models/ \;
7373
74+
- name: Check for large files
75+
run: |
76+
find content -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -o -name "*.svg" -o -name "*.gif" \) -size +2M -print0 |
77+
while IFS= read -r -d $'\0' file; do
78+
size=$(ls -lh "$file" | awk '{print $5}')
79+
echo "::warning file=$file::Image is very large: $size. Consider optimizing it."
80+
done
81+
82+
find content -type f \( -name "*.pdf" -o -name "*.zip" -o -name "*.mp4" \) -size +10M -print0 |
83+
while IFS= read -r -d $'\0' file; do
84+
size=$(ls -lh "$file" | awk '{print $5}')
85+
echo "::warning file=$file::Asset file is very large: $size. This can impact repository size and checkout times."
86+
done
87+
7488
- name: Gatsby main cache
7589
uses: actions/cache@v4
7690
id: gatsby-cache-folder
@@ -93,11 +107,9 @@ jobs:
93107

94108
- name: Patch Gatsby Config
95109
run: |
96-
sed -i.bak "s|path: \`\${__dirname}/content\`,\s*}|path: \`\${__dirname}/content\`,\n ignore: [\`**/*.zip\`, \`**/*.mp4\`, \`**/*.pdf\`, \`**/*.gif\`]\n }|" gatsby-config.js
110+
sed -i.bak "/path: \`${__dirname}\/content\`,\s*$/a \ \ \ \ \ \ \ \ ignore: [\`**/*.zip\`, \`**/*.mp4\`, \`**/*.pdf\`, \`**/*.gif\`]," gatsby-config.js
97111
98-
- name: Build with increased memory
99-
env:
100-
NODE_OPTIONS: --max-old-space-size=12288
112+
- name: Build
101113
run: npm run build
102114

103115
- name: Clean up node_modules # Just to save space

0 commit comments

Comments
 (0)